[libcxx] r246399 - Suppress clang warnings in some tests

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 30 15:04:21 PDT 2015


Author: ericwf
Date: Sun Aug 30 17:04:20 2015
New Revision: 246399

URL: http://llvm.org/viewvc/llvm-project?rev=246399&view=rev
Log:
Suppress clang warnings in some tests

Modified:
    libcxx/trunk/test/libcxx/double_include.sh.cpp
    libcxx/trunk/test/libcxx/test/config.py
    libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
    libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
    libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
    libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
    libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp
    libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp

Modified: libcxx/trunk/test/libcxx/double_include.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/double_include.sh.cpp (original)
+++ libcxx/trunk/test/libcxx/double_include.sh.cpp Sun Aug 30 17:04:20 2015
@@ -15,6 +15,12 @@
 // RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
 // RUN: %run
 
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
 #include <algorithm>
 #include <array>
 #include <bitset>
@@ -50,6 +56,7 @@
 #include <deque>
 #include <exception>
 #include <experimental/algorithm>
+#include <experimental/any>
 #include <experimental/chrono>
 #include <experimental/dynarray>
 #include <experimental/optional>

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Sun Aug 30 17:04:20 2015
@@ -578,6 +578,10 @@ class Configuration(object):
             self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
             self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
             self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
+            # TODO(EricWF) Remove the unused warnings once the test suite
+            # compiles clean with them.
+            self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
+            self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
             std = self.get_lit_conf('std', None)
             if std in ['c++98', 'c++03']:
                 # The '#define static_assert' provided by libc++ in C++03 mode

Modified: libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp Sun Aug 30 17:04:20 2015
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
 
 // <optional>
 
@@ -15,8 +17,6 @@
 #include <type_traits>
 #include <cassert>
 
-#if _LIBCPP_STD_VER > 11
-
 using std::experimental::optional;
 
 class X
@@ -39,18 +39,14 @@ public:
 
 class Z
 {
-    int i_;
 public:
-    Z(int i) : i_(i) {}
+    Z(int)  {}
     Z(const Z&) {throw 6;}
 };
 
 
-#endif  // _LIBCPP_STD_VER > 11
-
 int main()
 {
-#if _LIBCPP_STD_VER > 11
     {
         typedef int T;
         constexpr T t(5);
@@ -113,5 +109,4 @@ int main()
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }

Modified: libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp Sun Aug 30 17:04:20 2015
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
 
 // <optional>
 
@@ -16,7 +18,6 @@
 #include <type_traits>
 #include <cassert>
 
-#if _LIBCPP_STD_VER > 11
 
 using std::experimental::optional;
 using std::experimental::in_place_t;
@@ -52,17 +53,13 @@ public:
 
 class Z
 {
-    int i_;
 public:
-    Z(int i) : i_(i) {throw 6;}
+    Z(int i) {throw 6;}
 };
 
 
-#endif  // _LIBCPP_STD_VER > 11
-
 int main()
 {
-#if _LIBCPP_STD_VER > 11
     {
         constexpr optional<int> opt(in_place, 5);
         static_assert(static_cast<bool>(opt) == true, "");
@@ -141,5 +138,4 @@ int main()
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }

Modified: libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp Sun Aug 30 17:04:20 2015
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
 
 // <optional>
 
@@ -15,8 +17,6 @@
 #include <type_traits>
 #include <cassert>
 
-#if _LIBCPP_STD_VER > 11
-
 using std::experimental::optional;
 
 class X
@@ -41,17 +41,14 @@ public:
 
 class Z
 {
-    int i_;
 public:
-    Z(int i) : i_(i) {}
+    Z(int) {}
     Z(Z&&) {throw 6;}
 };
 
-#endif  // _LIBCPP_STD_VER > 11
 
 int main()
 {
-#if _LIBCPP_STD_VER > 11
     {
         typedef int T;
         constexpr optional<T> opt(T(5));
@@ -106,5 +103,4 @@ int main()
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }

Modified: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp Sun Aug 30 17:04:20 2015
@@ -17,6 +17,10 @@
 #include <sstream>
 #include <cassert>
 
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wliteral-conversion"
+#endif
+
 int main()
 {
     {

Modified: libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp Sun Aug 30 17:04:20 2015
@@ -52,6 +52,24 @@ void test_comparisons()
     assert(!(nullptr > p));
 }
 
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma diagnostic ignored "-Wnull-conversion"
+#endif
+void test_nullptr_conversions() {
+    {
+        bool b = nullptr;
+        assert(!b);
+    }
+    {
+        bool b(nullptr);
+        assert(!b);
+    }
+}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
 
 int main()
 {
@@ -72,8 +90,5 @@ int main()
         test_comparisons<A*>();
         test_comparisons<void(*)()>();
     }
-    {
-        bool b = nullptr;
-        assert(!b);
-    }
+    test_nullptr_conversions();
 }

Modified: libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp Sun Aug 30 17:04:20 2015
@@ -38,8 +38,6 @@ int move_only_constructed = 0;
 #if TEST_STD_VER >= 11
 class move_only
 {
-    int data;
-
     move_only(const move_only&) = delete;
     move_only& operator=(const move_only&)= delete;
 
@@ -49,6 +47,10 @@ public:
 
     move_only() {++move_only_constructed;}
     ~move_only() {--move_only_constructed;}
+
+public:
+    int data; // unused other than to make sizeof(move_only) == sizeof(int).
+              // but public to suppress "-Wunused-private-field"
 };
 #endif // TEST_STD_VER >= 11
 

Modified: libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp?rev=246399&r1=246398&r2=246399&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp Sun Aug 30 17:04:20 2015
@@ -13,6 +13,14 @@
 
 // Test the fallback implementation.
 
+// libc++ provides a fallback implementation of the compiler trait
+// `__is_convertible` with the same name when clang doesn't.
+// Because this test forces the use of the fallback even when clang provides
+// it causing a keyword incompatibility.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wkeyword-compat"
+#endif
+
 #define _LIBCPP_USE_IS_CONVERTIBLE_FALLBACK
 #include "is_convertible.pass.cpp"
 




More information about the cfe-commits mailing list