[libcxx] r272629 - Fix warnings in tests.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 20:21:50 PDT 2016


Author: ericwf
Date: Mon Jun 13 22:21:49 2016
New Revision: 272629

URL: http://llvm.org/viewvc/llvm-project?rev=272629&view=rev
Log:
Fix warnings in tests.

Modified:
    libcxx/trunk/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
    libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
    libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
    libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
    libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
    libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
    libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
    libcxx/trunk/test/support/assert_checkpoint.h

Modified: libcxx/trunk/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp Mon Jun 13 22:21:49 2016
@@ -25,30 +25,27 @@ template <int N> struct index {};
 void f(index<0>) {}
 
 int f(index<1>) { return 0; }
-int const f(index<2>) { return 0; }
-int volatile f(index<3>) { return 0; }
-int const volatile f(index<4>) { return 0; }
-
-int & f(index<5>) { return static_cast<int &>(my_int); }
-int const & f(index<6>) { return static_cast<int const &>(my_int); }
-int volatile & f(index<7>) { return static_cast<int volatile &>(my_int); }
-int const volatile & f(index<8>) { return static_cast<int const volatile &>(my_int); }
-
-int && f(index<9>) { return static_cast<int &&>(my_int); }
-int const && f(index<10>) { return static_cast<int const &&>(my_int); }
-int volatile && f(index<11>) { return static_cast<int volatile &&>(my_int); }
-int const volatile && f(index<12>) { return static_cast<int const volatile &&>(my_int); }
-
-int * f(index<13>) { return static_cast<int *>(&my_int); }
-int const * f(index<14>) { return static_cast<int const *>(&my_int); }
-int volatile * f(index<15>) { return static_cast<int volatile *>(&my_int); }
-int const volatile * f(index<16>) { return static_cast<int const volatile *>(&my_int); }
+
+int & f(index<2>) { return static_cast<int &>(my_int); }
+int const & f(index<3>) { return static_cast<int const &>(my_int); }
+int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
+int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
+
+int && f(index<6>) { return static_cast<int &&>(my_int); }
+int const && f(index<7>) { return static_cast<int const &&>(my_int); }
+int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
+int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
+
+int * f(index<10>) { return static_cast<int *>(&my_int); }
+int const * f(index<11>) { return static_cast<int const *>(&my_int); }
+int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
+int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
 
 
 template <int Func, class Expect>
 void test()
 {
-    using F = decltype((f(index<Func>{})));
+    using F = decltype(f(index<Func>{}));
     static_assert(std::is_same<F, Expect>::value, "");
 }
 
@@ -58,19 +55,16 @@ int main()
 {
     test<0, void>();
     test<1, int>();
-    //test<2, int const>();
-    //test<3, int volatile>();
-    //test<4, int const volatile>();
-    test<5, int &>();
-    test<6, int const &>();
-    test<7, int volatile &>();
-    test<8, int const volatile &>();
-    test<9, int &&>();
-    test<10, int const &&>();
-    test<11, int volatile &&>();
-    test<12, int const volatile &&>();
-    test<13, int *>();
-    test<14, int const *>();
-    test<15, int volatile *>();
-    test<16, int const volatile *>();
+    test<2, int &>();
+    test<3, int const &>();
+    test<4, int volatile &>();
+    test<5, int const volatile &>();
+    test<6, int &&>();
+    test<7, int const &&>();
+    test<8, int volatile &&>();
+    test<9, int const volatile &&>();
+    test<10, int *>();
+    test<11, int const *>();
+    test<12, int volatile *>();
+    test<13, int const volatile *>();
 }

Modified: libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp Mon Jun 13 22:21:49 2016
@@ -917,7 +917,7 @@ int main()
     std::uintmax_t i4 = 0;
     }
     {
-    std::imaxdiv_t  i1 = {0};
+    std::imaxdiv_t  i1 = {};
     }
     std::intmax_t i = 0;
     static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");

Modified: libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp Mon Jun 13 22:21:49 2016
@@ -87,7 +87,7 @@
 int main()
 {
     std::FILE* fp = 0;
-    std::fpos_t fpos = {0};
+    std::fpos_t fpos = {};
     std::size_t s = 0;
     char* cp = 0;
     std::va_list va;

Modified: libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp Mon Jun 13 22:21:49 2016
@@ -44,7 +44,7 @@ int main()
         testbuf<char> sb("  Sat Dec 31 23:55:59 2061");
         std::istream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
-        std::tm t = {0};
+        std::tm t = {};
         is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);
@@ -60,7 +60,7 @@ int main()
         testbuf<wchar_t> sb(L"  Sat Dec 31 23:55:59 2061");
         std::wistream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
-        std::tm t = {0};
+        std::tm t = {};
         is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);

Modified: libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp Mon Jun 13 22:21:49 2016
@@ -56,7 +56,7 @@ int main()
         testbuf<char> sb;
         std::ostream os(&sb);
         os.imbue(std::locale(LOCALE_en_US_UTF_8));
-        std::tm t = {0};
+        std::tm t = {};
         t.tm_sec = 59;
         t.tm_min = 55;
         t.tm_hour = 23;
@@ -72,7 +72,7 @@ int main()
         testbuf<wchar_t> sb;
         std::wostream os(&sb);
         os.imbue(std::locale(LOCALE_en_US_UTF_8));
-        std::tm t = {0};
+        std::tm t = {};
         t.tm_sec = 59;
         t.tm_min = 55;
         t.tm_hour = 23;

Modified: libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp Mon Jun 13 22:21:49 2016
@@ -25,7 +25,7 @@ int main()
     std::clock_t c = 0;
     std::size_t s = 0;
     std::time_t t = 0;
-    std::tm tm = {0};
+    std::tm tm = {};
     ((void)c); // Prevent unused warning
     ((void)s); // Prevent unused warning
     ((void)t); // Prevent unused warning

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp Mon Jun 13 22:21:49 2016
@@ -11,9 +11,15 @@
 
 // is_destructible
 
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
 #include <type_traits>
 #include "test_macros.h"
 
+
 template <class T>
 void test_is_destructible()
 {

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp Mon Jun 13 22:21:49 2016
@@ -11,6 +11,11 @@
 
 // is_nothrow_destructible
 
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
 #include <type_traits>
 #include "test_macros.h"
 

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp Mon Jun 13 22:21:49 2016
@@ -41,8 +41,8 @@ struct M {
 void swap(M&&, M&&) noexcept {}
 
 struct ThrowingMove {
-    ThrowingMove(ThrowingMove&&){}
-    ThrowingMove& operator=(ThrowingMove&&) {}
+    ThrowingMove(ThrowingMove&&) {}
+    ThrowingMove& operator=(ThrowingMove&&) { return *this; }
 };
 
 } // namespace MyNS

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp Mon Jun 13 22:21:49 2016
@@ -11,6 +11,11 @@
 
 // is_trivially_destructible
 
+// Prevent warning when testing the Abstract test type.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
+#endif
+
 #include <type_traits>
 #include "test_macros.h"
 

Modified: libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/time/date.time/ctime.pass.cpp Mon Jun 13 22:21:49 2016
@@ -23,7 +23,7 @@ int main()
     std::clock_t c = 0;
     std::size_t s = 0;
     std::time_t t = 0;
-    std::tm tm = {0};
+    std::tm tm = {};
     char str[3];
     ((void)c); // Prevent unused warning
     ((void)s); // Prevent unused warning

Modified: libcxx/trunk/test/support/assert_checkpoint.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/assert_checkpoint.h?rev=272629&r1=272628&r2=272629&view=diff
==============================================================================
--- libcxx/trunk/test/support/assert_checkpoint.h (original)
+++ libcxx/trunk/test/support/assert_checkpoint.h Mon Jun 13 22:21:49 2016
@@ -30,7 +30,7 @@ inline Checkpoint& globalCheckpoint() {
 }
 
 inline void clearCheckpoint() {
-    globalCheckpoint() = Checkpoint{0};
+    globalCheckpoint() = {};
 }
 
 #if defined(__GNUC__)




More information about the cfe-commits mailing list