Skip to content

Commit 1cac82c

Browse files
committed
[libc++] Fix a few warnings when running the test suite with GCC
1 parent 460202b commit 1cac82c

File tree

10 files changed

+22
-8
lines changed

10 files changed

+22
-8
lines changed

libcxx/test/libcxx/algorithms/debug_less.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ inline bool operator<(FooImp<T> const& x, Tag<0> y) {
183183
template <class T>
184184
inline bool operator<(Tag<0>, FooImp<T> const&) {
185185
static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
186+
return false;
186187
}
187188

188189
template <class T>
@@ -193,6 +194,7 @@ inline bool operator<(Tag<1> x, FooImp<T> const& y) {
193194
template <class T>
194195
inline bool operator<(FooImp<T> const&, Tag<1>) {
195196
static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
197+
return false;
196198
}
197199

198200
typedef FooImp<> Foo;

libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// XFAIL: libcpp-has-no-threads
99

1010
#ifdef _LIBCPP_HAS_NO_THREADS
11-
#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
11+
#error This should be XFAILed for the purpose of detecting that the LIT feature\
1212
'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
1313
#endif
1414

libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#if defined(__GNUC__) || defined(__clang__)
10-
#pragma GCC diagnostic ignored "-W#warnings"
9+
#if defined(__clang__)
10+
#pragma clang diagnostic ignored "-W#warnings"
1111
#endif
1212

1313
#define min THIS IS A NASTY MACRO!

libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
109
// Prevent emission of the deprecated warning.
1110
#ifdef __clang__
1211
#pragma clang diagnostic ignored "-W#warnings"
1312
#endif
13+
#ifdef __GNUC__
14+
#pragma GCC diagnostic ignored "-Wcpp"
15+
#endif
1416

1517
#include <ext/hash_map>
1618
#include <cassert>

libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#ifdef __clang__
1111
#pragma clang diagnostic ignored "-W#warnings"
1212
#endif
13+
#ifdef __GNUC__
14+
#pragma GCC diagnostic push "-Wcpp"
15+
#endif
1316

1417
// Poison the std:: names we might use inside __gnu_cxx to ensure they're
1518
// properly qualified.

libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
109
// Prevent emission of the deprecated warning.
1110
#ifdef __clang__
1211
#pragma clang diagnostic ignored "-W#warnings"
1312
#endif
13+
#ifdef __GNUC__
14+
#pragma GCC diagnostic ignored "-Wcpp"
15+
#endif
1416

1517
#include <ext/hash_set>
1618
#include <cassert>

libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#ifdef __clang__
1111
#pragma clang diagnostic ignored "-W#warnings"
1212
#endif
13+
#ifdef __GNUC__
14+
#pragma GCC diagnostic ignored "-Wcpp"
15+
#endif
16+
1317
// Poison the std:: names we might use inside __gnu_cxx to ensure they're
1418
// properly qualified.
1519
struct allocator;

libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//
66
//===----------------------------------------------------------------------===//
77

8-
#if defined(__GNUC__) || defined(__clang__)
9-
#pragma GCC diagnostic ignored "-W#warnings"
8+
#if defined(__clang__)
9+
#pragma clang diagnostic ignored "-W#warnings"
1010
#endif
1111

1212
#define min THIS IS A NASTY MACRO!

libcxx/test/support/container_debug_tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <ciso646>
1313
#ifndef _LIBCPP_VERSION
14-
#error This header may only be used for libc++ tests"
14+
#error This header may only be used for libc++ tests
1515
#endif
1616

1717
#ifndef _LIBCPP_DEBUG

libcxx/test/support/debug_mode_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ inline bool ExpectDeath(const char* stmt, Func&& func, DebugInfoMatcher Matcher)
287287
case DeathTest::RK_MatchFailure:
288288
return OnFailure("matcher failed");
289289
}
290+
assert(false && "unreachable");
290291
}
291292

292293
template <class Func>

0 commit comments

Comments
 (0)