Suppress clang warnings in some tests

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246399 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 5620e5b..99767cf 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -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>
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index 5171f25..f66b831 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -578,6 +578,10 @@
             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
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
index 071f594..c782d10 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -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 @@
 
 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 @@
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
index 412c993..ae53211 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -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 @@
 
 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 @@
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
index ac52a42..71bf353 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -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 @@
 
 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 @@
             assert(i == 6);
         }
     }
-#endif  // _LIBCPP_STD_VER > 11
 }
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
index 02ef571..932ef25 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
@@ -17,6 +17,10 @@
 #include <sstream>
 #include <cassert>
 
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wliteral-conversion"
+#endif
+
 int main()
 {
     {
diff --git a/test/std/language.support/support.types/nullptr_t.pass.cpp b/test/std/language.support/support.types/nullptr_t.pass.cpp
index 4d7c8b0..99bbd3e 100644
--- a/test/std/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/std/language.support/support.types/nullptr_t.pass.cpp
@@ -52,6 +52,24 @@
     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 @@
         test_comparisons<A*>();
         test_comparisons<void(*)()>();
     }
-    {
-        bool b = nullptr;
-        assert(!b);
-    }
+    test_nullptr_conversions();
 }
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
index 40c44d9..28dadd8 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
@@ -38,8 +38,6 @@
 #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 @@
 
     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
 
diff --git a/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp b/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
index bd35ef6..5a607f3 100644
--- a/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
@@ -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"