From 212714f805dc3b00e351b1556395f18c5ae70c25 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 18 Jul 2015 22:51:51 +0000 Subject: [PATCH] Cleanup warnings in test/std/depr git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242627 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/libcxx/test/config.py | 6 ++++-- .../auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp | 4 ++++ .../depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp | 3 ++- test/std/depr/depr.c.headers/inttypes_h.pass.cpp | 3 ++- test/std/depr/depr.c.headers/locale_h.pass.cpp | 2 +- test/std/depr/depr.c.headers/signal_h.pass.cpp | 2 +- test/std/depr/depr.c.headers/stdarg_h.pass.cpp | 1 + test/std/depr/depr.c.headers/stdio_h.pass.cpp | 11 +++++++---- test/std/depr/depr.c.headers/stdlib_h.pass.cpp | 8 ++++---- test/std/depr/depr.c.headers/time_h.pass.cpp | 2 +- test/std/depr/depr.c.headers/wchar_h.pass.cpp | 4 ++++ .../unexpected.handler/unexpected_handler.pass.cpp | 1 + 12 files changed, 32 insertions(+), 15 deletions(-) diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py index 41e015a7..cd5ee280 100644 --- a/test/libcxx/test/config.py +++ b/test/libcxx/test/config.py @@ -574,8 +574,10 @@ class Configuration(object): '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Werror' ] - self.cxx.addCompileFlagIfSupported('-Wno-c++11-extensions') - self.cxx.addCompileFlagIfSupported('-Wno-user-defined-literals') + self.cxx.addCompileFlagIfSupported('-Wno-attributes') + if self.cxx.type == 'clang' or self.cxx.type == 'apple-clang': + self.cxx.addCompileFlagIfSupported('-Wno-c++11-extensions') + self.cxx.addCompileFlagIfSupported('-Wno-user-defined-literals') def configure_sanitizer(self): san = self.get_lit_conf('use_sanitizer', '').strip() diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp index f61a28e8..a5db81e6 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp @@ -24,6 +24,10 @@ test() B* p1 = new B(1); std::auto_ptr ap1(p1); std::auto_ptr_ref apr = ap1; + std::auto_ptr ap2(apr); + assert(ap1.get() == nullptr); + assert(ap2.get() == p1); + ap2.release(); delete p1; } diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp index 2d1c2af8..25656343 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp @@ -25,6 +25,8 @@ void test() { static_assert((std::is_same::element_type, T>::value), ""); + std::auto_ptr p; + ((void)p); } int main() @@ -32,5 +34,4 @@ int main() test(); test(); test(); - std::auto_ptr p; } diff --git a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp index 4adf82da..a799aea2 100644 --- a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp +++ b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp @@ -631,7 +631,8 @@ int main() { { - imaxdiv_t i1 = {0}; + imaxdiv_t i1 = {0}; + ((void)i1); } intmax_t i = 0; static_assert((std::is_same::value), ""); diff --git a/test/std/depr/depr.c.headers/locale_h.pass.cpp b/test/std/depr/depr.c.headers/locale_h.pass.cpp index 6ecf5a82..f5735b6e 100644 --- a/test/std/depr/depr.c.headers/locale_h.pass.cpp +++ b/test/std/depr/depr.c.headers/locale_h.pass.cpp @@ -42,7 +42,7 @@ int main() { - lconv lc; + lconv lc; ((void)lc); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); } diff --git a/test/std/depr/depr.c.headers/signal_h.pass.cpp b/test/std/depr/depr.c.headers/signal_h.pass.cpp index a8ef5f99..83f45c9b 100644 --- a/test/std/depr/depr.c.headers/signal_h.pass.cpp +++ b/test/std/depr/depr.c.headers/signal_h.pass.cpp @@ -50,7 +50,7 @@ int main() { - sig_atomic_t sig; + sig_atomic_t sig; ((void)sig); typedef void (*func)(int); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp index 7a609025..f7d12b1a 100644 --- a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp @@ -32,4 +32,5 @@ int main() { va_list va; + ((void)va); } diff --git a/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/test/std/depr/depr.c.headers/stdio_h.pass.cpp index d4cfbc80..ba6714dd 100644 --- a/test/std/depr/depr.c.headers/stdio_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stdio_h.pass.cpp @@ -11,6 +11,7 @@ #include #include +#include "test_macros.h" #ifndef BUFSIZ #error BUFSIZ not defined @@ -78,14 +79,16 @@ #include -#pragma clang diagnostic ignored "-Wformat-zero-length" +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for tmpnam int main() { FILE* fp = 0; fpos_t fpos = {0}; - size_t s = 0; + size_t s = 0; ((void)s); char* cp = 0; + char arr[] = {'a', 'b'}; va_list va; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); @@ -117,7 +120,7 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if _LIBCPP_STD_VER < 14 +#if TEST_STD_VER < 14 static_assert((std::is_same::value), ""); #endif static_assert((std::is_same::value), ""); @@ -125,7 +128,7 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp index 47e1527f..d1cc4431 100644 --- a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp @@ -34,10 +34,10 @@ int main() { - size_t s = 0; - div_t d; - ldiv_t ld; - lldiv_t lld; + size_t s = 0; ((void)s); + div_t d; ((void)d); + ldiv_t ld; ((void)ld); + lldiv_t lld; ((void)lld); char** endptr = 0; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/depr/depr.c.headers/time_h.pass.cpp b/test/std/depr/depr.c.headers/time_h.pass.cpp index c468693c..0d229af4 100644 --- a/test/std/depr/depr.c.headers/time_h.pass.cpp +++ b/test/std/depr/depr.c.headers/time_h.pass.cpp @@ -22,7 +22,7 @@ int main() { - clock_t c = 0; + clock_t c = 0; ((void)c); size_t s = 0; time_t t = 0; tm tmv = {0}; diff --git a/test/std/depr/depr.c.headers/wchar_h.pass.cpp b/test/std/depr/depr.c.headers/wchar_h.pass.cpp index 68bea49c..8d1c3b79 100644 --- a/test/std/depr/depr.c.headers/wchar_h.pass.cpp +++ b/test/std/depr/depr.c.headers/wchar_h.pass.cpp @@ -28,6 +28,10 @@ #error WEOF not defined #endif +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wmissing-braces" +#endif + int main() { mbstate_t mb = {0}; diff --git a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp index 7fab5008..58795293 100644 --- a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp +++ b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp @@ -16,4 +16,5 @@ void f() {} int main() { std::unexpected_handler p = f; + ((void)p); }