[libcxx] r242627 - Cleanup warnings in test/std/depr

Eric Fiselier eric at efcs.ca
Sat Jul 18 15:51:51 PDT 2015


Author: ericwf
Date: Sat Jul 18 17:51:51 2015
New Revision: 242627

URL: http://llvm.org/viewvc/llvm-project?rev=242627&view=rev
Log:
Cleanup warnings in test/std/depr

Modified:
    libcxx/trunk/test/libcxx/test/config.py
    libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
    libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/locale_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/signal_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
    libcxx/trunk/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Sat Jul 18 17:51:51 2015
@@ -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()

Modified: libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp Sat Jul 18 17:51:51 2015
@@ -24,6 +24,10 @@ test()
     B* p1 = new B(1);
     std::auto_ptr<B> ap1(p1);
     std::auto_ptr_ref<A> apr = ap1;
+    std::auto_ptr<A> ap2(apr);
+    assert(ap1.get() == nullptr);
+    assert(ap2.get() == p1);
+    ap2.release();
     delete p1;
 }
 

Modified: libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp Sat Jul 18 17:51:51 2015
@@ -25,6 +25,8 @@ void
 test()
 {
     static_assert((std::is_same<typename std::auto_ptr<T>::element_type, T>::value), "");
+    std::auto_ptr<T> p;
+    ((void)p);
 }
 
 int main()
@@ -32,5 +34,4 @@ int main()
     test<int>();
     test<double>();
     test<void>();
-    std::auto_ptr<void> p;
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -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<decltype(imaxabs(i)), intmax_t>::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/locale_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/locale_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/locale_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/locale_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -42,7 +42,7 @@
 
 int main()
 {
-    lconv lc;
+    lconv lc; ((void)lc);
     static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
     static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/signal_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/signal_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/signal_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/signal_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -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<decltype(signal(0, (func)0)), func>::value), "");
     static_assert((std::is_same<decltype(raise(0)), int>::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdarg_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/stdarg_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdarg_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -32,4 +32,5 @@
 int main()
 {
     va_list va;
+    ((void)va);
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <type_traits>
+#include "test_macros.h"
 
 #ifndef BUFSIZ
 #error BUFSIZ not defined
@@ -78,14 +79,16 @@
 
 #include <cstdarg>
 
-#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<decltype(remove("")), int>::value), "");
     static_assert((std::is_same<decltype(rename("","")), int>::value), "");
@@ -117,7 +120,7 @@ int main()
     static_assert((std::is_same<decltype(fputs("",fp)), int>::value), "");
     static_assert((std::is_same<decltype(getc(fp)), int>::value), "");
     static_assert((std::is_same<decltype(getchar()), int>::value), "");
-#if _LIBCPP_STD_VER < 14
+#if TEST_STD_VER < 14
     static_assert((std::is_same<decltype(gets(cp)), char*>::value), "");
 #endif
     static_assert((std::is_same<decltype(putc(0,fp)), int>::value), "");
@@ -125,7 +128,7 @@ int main()
     static_assert((std::is_same<decltype(puts("")), int>::value), "");
     static_assert((std::is_same<decltype(ungetc(0,fp)), int>::value), "");
     static_assert((std::is_same<decltype(fread((void*)0,0,0,fp)), size_t>::value), "");
-    static_assert((std::is_same<decltype(fwrite((const void*)0,0,0,fp)), size_t>::value), "");
+    static_assert((std::is_same<decltype(fwrite((const void*)arr,1,0,fp)), size_t>::value), "");
     static_assert((std::is_same<decltype(fgetpos(fp, &fpos)), int>::value), "");
     static_assert((std::is_same<decltype(fseek(fp, 0,0)), int>::value), "");
     static_assert((std::is_same<decltype(fsetpos(fp, &fpos)), int>::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -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<decltype(atof("")), double>::value), "");
     static_assert((std::is_same<decltype(atoi("")), int>::value), "");

Modified: libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/time_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -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};

Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Sat Jul 18 17:51:51 2015
@@ -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};

Modified: libcxx/trunk/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp?rev=242627&r1=242626&r2=242627&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp Sat Jul 18 17:51:51 2015
@@ -16,4 +16,5 @@ void f() {}
 int main()
 {
     std::unexpected_handler p = f;
+    ((void)p);
 }





More information about the cfe-commits mailing list