[libcxx-commits] [libcxx] 1cac82c - [libc++] Fix a few warnings when running the test suite with GCC
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 20 10:56:23 PDT 2020
Author: Louis Dionne
Date: 2020-04-20T13:48:50-04:00
New Revision: 1cac82cf388c1321adf8c3e892027a4491a29e3a
URL: https://github.com/llvm/llvm-project/commit/1cac82cf388c1321adf8c3e892027a4491a29e3a
DIFF: https://github.com/llvm/llvm-project/commit/1cac82cf388c1321adf8c3e892027a4491a29e3a.diff
LOG: [libc++] Fix a few warnings when running the test suite with GCC
Added:
Modified:
libcxx/test/libcxx/algorithms/debug_less.pass.cpp
libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp
libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp
libcxx/test/support/container_debug_tests.h
libcxx/test/support/debug_mode_helper.h
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
index 5d1b575b5129..6a05b8db67a8 100644
--- a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp
@@ -183,6 +183,7 @@ inline bool operator<(FooImp<T> const& x, Tag<0> y) {
template <class T>
inline bool operator<(Tag<0>, FooImp<T> const&) {
static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+ return false;
}
template <class T>
@@ -193,6 +194,7 @@ inline bool operator<(Tag<1> x, FooImp<T> const& y) {
template <class T>
inline bool operator<(FooImp<T> const&, Tag<1>) {
static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+ return false;
}
typedef FooImp<> Foo;
diff --git a/libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp b/libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
index af2d55e1a4a3..b52ba6425223 100644
--- a/libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
+++ b/libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
@@ -8,7 +8,7 @@
// XFAIL: libcpp-has-no-threads
#ifdef _LIBCPP_HAS_NO_THREADS
-#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
+#error This should be XFAILed for the purpose of detecting that the LIT feature\
'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
#endif
diff --git a/libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp b/libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp
index 1408da974029..ff15f355f825 100644
--- a/libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/undef_min_max.pass.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic ignored "-W#warnings"
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-W#warnings"
#endif
#define min THIS IS A NASTY MACRO!
diff --git a/libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp b/libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
index df413186959d..ff268cd0c53c 100644
--- a/libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
+++ b/libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
-
// Prevent emission of the deprecated warning.
#ifdef __clang__
#pragma clang diagnostic ignored "-W#warnings"
#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wcpp"
+#endif
#include <ext/hash_map>
#include <cassert>
diff --git a/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp b/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
index bfcb8aeda3f9..31e877eda822 100644
--- a/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
+++ b/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
@@ -10,6 +10,9 @@
#ifdef __clang__
#pragma clang diagnostic ignored "-W#warnings"
#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic push "-Wcpp"
+#endif
// Poison the std:: names we might use inside __gnu_cxx to ensure they're
// properly qualified.
diff --git a/libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp b/libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
index 307ba7368d16..bfdbb38b2a89 100644
--- a/libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
+++ b/libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
-
// Prevent emission of the deprecated warning.
#ifdef __clang__
#pragma clang diagnostic ignored "-W#warnings"
#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wcpp"
+#endif
#include <ext/hash_set>
#include <cassert>
diff --git a/libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp b/libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
index b3e1e1956632..6e50137ceb71 100644
--- a/libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
+++ b/libcxx/test/libcxx/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
@@ -10,6 +10,10 @@
#ifdef __clang__
#pragma clang diagnostic ignored "-W#warnings"
#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wcpp"
+#endif
+
// Poison the std:: names we might use inside __gnu_cxx to ensure they're
// properly qualified.
struct allocator;
diff --git a/libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp b/libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp
index ba1696eb2405..a9f50171543b 100644
--- a/libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp
+++ b/libcxx/test/libcxx/numerics/c.math/undef_min_max.pass.cpp
@@ -5,8 +5,8 @@
//
//===----------------------------------------------------------------------===//
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic ignored "-W#warnings"
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-W#warnings"
#endif
#define min THIS IS A NASTY MACRO!
diff --git a/libcxx/test/support/container_debug_tests.h b/libcxx/test/support/container_debug_tests.h
index 36496c24e2bc..e0b0df3b3b60 100644
--- a/libcxx/test/support/container_debug_tests.h
+++ b/libcxx/test/support/container_debug_tests.h
@@ -11,7 +11,7 @@
#include <ciso646>
#ifndef _LIBCPP_VERSION
-#error This header may only be used for libc++ tests"
+#error This header may only be used for libc++ tests
#endif
#ifndef _LIBCPP_DEBUG
diff --git a/libcxx/test/support/debug_mode_helper.h b/libcxx/test/support/debug_mode_helper.h
index ed111ab127ce..8256f3eb3828 100644
--- a/libcxx/test/support/debug_mode_helper.h
+++ b/libcxx/test/support/debug_mode_helper.h
@@ -287,6 +287,7 @@ inline bool ExpectDeath(const char* stmt, Func&& func, DebugInfoMatcher Matcher)
case DeathTest::RK_MatchFailure:
return OnFailure("matcher failed");
}
+ assert(false && "unreachable");
}
template <class Func>
More information about the libcxx-commits
mailing list