From bfdae2062a086dbfeb47774afcf429402cb39c57 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Tue, 14 Jun 2016 03:21:49 +0000 Subject: [PATCH] Fix warnings in tests. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272629 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../tuple/tuple.apply/return_type.pass.cpp | 56 +++++++++---------- .../file.streams/c.files/cinttypes.pass.cpp | 2 +- .../file.streams/c.files/cstdio.pass.cpp | 2 +- .../ext.manip/get_time.pass.cpp | 4 +- .../ext.manip/put_time.pass.cpp | 4 +- .../support.runtime/ctime.pass.cpp | 2 +- .../meta.unary.prop/is_destructible.pass.cpp | 6 ++ .../is_nothrow_destructible.pass.cpp | 5 ++ .../is_nothrow_swappable.pass.cpp | 4 +- .../is_trivially_destructible.pass.cpp | 5 ++ .../utilities/time/date.time/ctime.pass.cpp | 2 +- test/support/assert_checkpoint.h | 2 +- 12 files changed, 52 insertions(+), 42 deletions(-) diff --git a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp index 1ec38da5c..314d2783f 100644 --- a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp +++ b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp @@ -25,30 +25,27 @@ template 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(my_int); } -int const & f(index<6>) { return static_cast(my_int); } -int volatile & f(index<7>) { return static_cast(my_int); } -int const volatile & f(index<8>) { return static_cast(my_int); } +int & f(index<2>) { return static_cast(my_int); } +int const & f(index<3>) { return static_cast(my_int); } +int volatile & f(index<4>) { return static_cast(my_int); } +int const volatile & f(index<5>) { return static_cast(my_int); } -int && f(index<9>) { return static_cast(my_int); } -int const && f(index<10>) { return static_cast(my_int); } -int volatile && f(index<11>) { return static_cast(my_int); } -int const volatile && f(index<12>) { return static_cast(my_int); } +int && f(index<6>) { return static_cast(my_int); } +int const && f(index<7>) { return static_cast(my_int); } +int volatile && f(index<8>) { return static_cast(my_int); } +int const volatile && f(index<9>) { return static_cast(my_int); } -int * f(index<13>) { return static_cast(&my_int); } -int const * f(index<14>) { return static_cast(&my_int); } -int volatile * f(index<15>) { return static_cast(&my_int); } -int const volatile * f(index<16>) { return static_cast(&my_int); } +int * f(index<10>) { return static_cast(&my_int); } +int const * f(index<11>) { return static_cast(&my_int); } +int volatile * f(index<12>) { return static_cast(&my_int); } +int const volatile * f(index<13>) { return static_cast(&my_int); } template void test() { - using F = decltype((f(index{}))); + using F = decltype(f(index{})); static_assert(std::is_same::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 *>(); } diff --git a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp index 4cb2c4c2f..893795052 100644 --- a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp +++ b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp @@ -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::value), ""); diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp index c42e205fd..4c2be7d4a 100644 --- a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp +++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp @@ -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; diff --git a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp index a8b82a62b..553c2b2eb 100644 --- a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp +++ b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp @@ -44,7 +44,7 @@ int main() testbuf 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 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); diff --git a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp index f4e3ded17..e907708d0 100644 --- a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp +++ b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp @@ -56,7 +56,7 @@ int main() testbuf 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 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; diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp index 5f2948605..34343b247 100644 --- a/test/std/language.support/support.runtime/ctime.pass.cpp +++ b/test/std/language.support/support.runtime/ctime.pass.cpp @@ -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 diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp index 60d607aba..5e8bfeaa4 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp @@ -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 #include "test_macros.h" + template void test_is_destructible() { diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp index 42c9807ef..58e0e0f98 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp @@ -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 #include "test_macros.h" diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp index 246598735..f2442f71d 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp @@ -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 diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp index 9e2507067..3372e615d 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp @@ -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 #include "test_macros.h" diff --git a/test/std/utilities/time/date.time/ctime.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp index b762d273d..b9e19af32 100644 --- a/test/std/utilities/time/date.time/ctime.pass.cpp +++ b/test/std/utilities/time/date.time/ctime.pass.cpp @@ -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 diff --git a/test/support/assert_checkpoint.h b/test/support/assert_checkpoint.h index c83e0cf25..cf03328bb 100644 --- a/test/support/assert_checkpoint.h +++ b/test/support/assert_checkpoint.h @@ -30,7 +30,7 @@ inline Checkpoint& globalCheckpoint() { } inline void clearCheckpoint() { - globalCheckpoint() = Checkpoint{0}; + globalCheckpoint() = {}; } #if defined(__GNUC__)