[libcxxabi] r290471 - Fix warnings in libc++abi tests

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 23 16:37:13 PST 2016


Author: ericwf
Date: Fri Dec 23 18:37:13 2016
New Revision: 290471

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

Modified:
    libcxxabi/trunk/test/backtrace_test.pass.cpp
    libcxxabi/trunk/test/cxa_bad_cast.pass.cpp
    libcxxabi/trunk/test/test_aux_runtime.pass.cpp
    libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp
    libcxxabi/trunk/test/test_exception_storage.pass.cpp
    libcxxabi/trunk/test/test_fallback_malloc.pass.cpp
    libcxxabi/trunk/test/test_guard.pass.cpp
    libcxxabi/trunk/test/test_vector1.pass.cpp
    libcxxabi/trunk/test/test_vector2.pass.cpp
    libcxxabi/trunk/test/test_vector3.pass.cpp
    libcxxabi/trunk/test/unwind_06.pass.cpp

Modified: libcxxabi/trunk/test/backtrace_test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/backtrace_test.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/backtrace_test.pass.cpp (original)
+++ libcxxabi/trunk/test/backtrace_test.pass.cpp Fri Dec 23 18:37:13 2016
@@ -14,7 +14,7 @@
 #include <unwind.h>
 
 extern "C" _Unwind_Reason_Code
-trace_function(struct _Unwind_Context* context, void* ntraced) {
+trace_function(struct _Unwind_Context*, void* ntraced) {
   (*reinterpret_cast<size_t*>(ntraced))++;
   // We should never have a call stack this deep...
   assert(*reinterpret_cast<size_t*>(ntraced) < 20);

Modified: libcxxabi/trunk/test/cxa_bad_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/cxa_bad_cast.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/cxa_bad_cast.pass.cpp (original)
+++ libcxxabi/trunk/test/cxa_bad_cast.pass.cpp Fri Dec 23 18:37:13 2016
@@ -40,6 +40,7 @@ int main ()
 #endif
         Derived &d = test_bad_cast(gB);
         assert(false);
+        ((void)d);
 #ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
     } catch (std::bad_cast) {
         // success

Modified: libcxxabi/trunk/test/test_aux_runtime.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_aux_runtime.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_aux_runtime.pass.cpp (original)
+++ libcxxabi/trunk/test/test_aux_runtime.pass.cpp Fri Dec 23 18:37:13 2016
@@ -28,8 +28,8 @@ bool bad_typeid_test () {
     class B { virtual void g() {}}; 
     
     B *bp = NULL;
-    try {bool b = typeid(*bp) == typeid (A); }
-    catch ( const std::bad_typeid &bc ) { return true; }
+    try {bool b = typeid(*bp) == typeid (A); ((void)b); }
+    catch ( const std::bad_typeid &) { return true; }
     return false;
     }
     
@@ -44,12 +44,12 @@ bool bad_cast_test () {
 
     D d;
     B *bp = (B*)&d;     // cast needed to break protection
-    try { D &dr = dynamic_cast<D&> (*bp); }
-    catch ( const std::bad_cast &bc ) { return true; }
+    try { D &dr = dynamic_cast<D&> (*bp); ((void)dr); }
+    catch ( const std::bad_cast & ) { return true; }
     return false;
     }
     
-int main ( int argc, char *argv [] ) {
+int main ( ) {
     int ret_val = 0;
     
     if ( !bad_typeid_test ()) {

Modified: libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp (original)
+++ libcxxabi/trunk/test/test_aux_runtime_op_array_new.pass.cpp Fri Dec 23 18:37:13 2016
@@ -28,7 +28,7 @@ bool bad_array_new_length_test() {
     return false;
 }
 
-int main(int argc, char *argv []) {
+int main() {
     int ret_val = 0;
 
     if ( !bad_array_new_length_test ()) {

Modified: libcxxabi/trunk/test/test_exception_storage.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_exception_storage.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_exception_storage.pass.cpp (original)
+++ libcxxabi/trunk/test/test_exception_storage.pass.cpp Fri Dec 23 18:37:13 2016
@@ -42,7 +42,7 @@ size_t                 thread_globals [
 __libcxxabi_thread_t   threads        [ NUMTHREADS ];
 #endif
 
-int main ( int argc, char *argv [] ) {
+int main () {
     int retVal = 0;
 
 #ifndef _LIBCXXABI_HAS_NO_THREADS

Modified: libcxxabi/trunk/test/test_fallback_malloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_fallback_malloc.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_fallback_malloc.pass.cpp (original)
+++ libcxxabi/trunk/test/test_fallback_malloc.pass.cpp Fri Dec 23 18:37:13 2016
@@ -165,7 +165,7 @@ void exhaustion_test3 () {
     }
 
     
-int main ( int argc, char *argv [] ) {
+int main () {
     print_free_list ();
 
     char *p = (char *) fallback_malloc ( 1024 );    // too big!

Modified: libcxxabi/trunk/test/test_guard.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_guard.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_guard.pass.cpp (original)
+++ libcxxabi/trunk/test/test_guard.pass.cpp Fri Dec 23 18:37:13 2016
@@ -25,11 +25,12 @@ namespace test1 {
     }
     void helper() {
         static int a = increment();
+        ((void)a);
     }
     void test() {
-        static int a = increment();
+        static int a = increment(); ((void)a);
         assert(run_count == 1);
-        static int b = increment();
+        static int b = increment(); ((void)b);
         assert(run_count == 2);
         helper();
         assert(run_count == 3);
@@ -50,7 +51,8 @@ namespace test2 {
     void helper() {
         try {
             static int a = increment();
-            assert(0);
+            assert(false);
+            ((void)a);
         } catch (...) {}
     }
     void test() {
@@ -71,12 +73,12 @@ namespace test3 {
     }
 
     int one() {
-        static int b = zero();
+        static int b = zero(); ((void)b);
         return 0;
     }
 
     void test() {
-        static int a = one();
+        static int a = one(); ((void)a);
     }
 }
 
@@ -91,7 +93,7 @@ namespace test4 {
     }
 
     void helper() {
-        static int a = increment();
+        static int a = increment(); ((void)a);
     }
 
     void test() {
@@ -112,16 +114,16 @@ namespace test5 {
     }
 
     int one() {
-        static int b = zero();
+        static int b = zero(); ((void)b);
         return 0;
     }
 
     void another_helper() {
-        static int a = one();
+        static int a = one(); ((void)a);
     }
 
     void helper() {
-        static int a = one();
+        static int a = one(); ((void)a);
         std::thread t(another_helper);
         t.join();
     }

Modified: libcxxabi/trunk/test/test_vector1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_vector1.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_vector1.pass.cpp (original)
+++ libcxxabi/trunk/test/test_vector1.pass.cpp Fri Dec 23 18:37:13 2016
@@ -25,36 +25,36 @@ void my_dealloc2 ( void *p ) {
     std::free ( p ); 
     }
 
-void my_dealloc3 ( void *p, size_t   sz   ) {
+void my_dealloc3 ( void *p, size_t ) {
 //  std::printf ( "Freeing %lx (size %ld)\n", (unsigned long) p, sz );  
     std::free ( p ); 
     }
 
-void my_construct ( void *p ) {
+void my_construct ( void * ) {
 //  std::printf ( "Constructing %lx\n", (unsigned long) p );
     }
 
-void my_destruct  ( void *p ) {
+void my_destruct  ( void * ) {
 //  std::printf ( "Destructing  %lx\n", (unsigned long) p );
     }
 
 int gCounter;
-void count_construct ( void *p ) { ++gCounter; }
-void count_destruct  ( void *p ) { --gCounter; }
+void count_construct ( void * ) { ++gCounter; }
+void count_destruct  ( void * ) { --gCounter; }
 
 
 int gConstructorCounter;
 int gConstructorThrowTarget;
 int gDestructorCounter;
 int gDestructorThrowTarget;
-void throw_construct ( void *p ) {
+void throw_construct ( void * ) {
 #ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
     if ( gConstructorCounter   == gConstructorThrowTarget )
         throw 1;
     ++gConstructorCounter;
 #endif
 }
-void throw_destruct  ( void *p ) {
+void throw_destruct  ( void * ) {
 #ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
     if ( ++gDestructorCounter  == gDestructorThrowTarget  )
         throw 2;
@@ -269,7 +269,7 @@ int test_exception_in_destructor ( ) {
     }
 #endif
 
-int main ( int argc, char *argv [] ) {
+int main () {
     int retVal = 0;
     retVal += test_empty ();
     retVal += test_counted ();

Modified: libcxxabi/trunk/test/test_vector2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_vector2.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_vector2.pass.cpp (original)
+++ libcxxabi/trunk/test/test_vector2.pass.cpp Fri Dec 23 18:37:13 2016
@@ -28,30 +28,30 @@ void my_dealloc2 ( void *p ) {
     std::free ( p ); 
     }
 
-void my_dealloc3 ( void *p, size_t   sz   ) {
+void my_dealloc3 ( void *p, size_t ) {
 //  std::printf ( "Freeing %lx (size %ld)\n", (unsigned long) p, sz );  
     std::free ( p ); 
     }
 
-void my_construct ( void *p ) {
+void my_construct ( void *) {
 //  std::printf ( "Constructing %lx\n", (unsigned long) p );
     }
 
-void my_destruct  ( void *p ) {
+void my_destruct  ( void *) {
 //  std::printf ( "Destructing  %lx\n", (unsigned long) p );
     }
 
 int gCounter;
-void count_construct ( void *p ) { ++gCounter; }
-void count_destruct  ( void *p ) { --gCounter; }
+void count_construct ( void * ) { ++gCounter; }
+void count_destruct  ( void * ) { --gCounter; }
 
 
 int gConstructorCounter;
 int gConstructorThrowTarget;
 int gDestructorCounter;
 int gDestructorThrowTarget;
-void throw_construct ( void *p ) { if ( gConstructorCounter   == gConstructorThrowTarget ) throw 1; ++gConstructorCounter; }
-void throw_destruct  ( void *p ) { if ( ++gDestructorCounter  == gDestructorThrowTarget  ) throw 2; }
+void throw_construct ( void * ) { if ( gConstructorCounter   == gConstructorThrowTarget ) throw 1; ++gConstructorCounter; }
+void throw_destruct  ( void * ) { if ( ++gDestructorCounter  == gDestructorThrowTarget  ) throw 2; }
 
 struct vec_on_stack {
     void *storage;
@@ -78,7 +78,7 @@ void test_exception_in_destructor ( ) {
 
 
 
-int main ( int argc, char *argv [] ) {
+int main () {
     std::set_terminate ( my_terminate );
     test_exception_in_destructor ();
     return 1;       // we failed if we get here

Modified: libcxxabi/trunk/test/test_vector3.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_vector3.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_vector3.pass.cpp (original)
+++ libcxxabi/trunk/test/test_vector3.pass.cpp Fri Dec 23 18:37:13 2016
@@ -48,7 +48,7 @@ void destroy(void* v)
   t->~T();
 }
 
-int main( int argc, char *argv [])
+int main()
 {
   std::set_terminate(my_terminate);
   {

Modified: libcxxabi/trunk/test/unwind_06.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/unwind_06.pass.cpp?rev=290471&r1=290470&r2=290471&view=diff
==============================================================================
--- libcxxabi/trunk/test/unwind_06.pass.cpp (original)
+++ libcxxabi/trunk/test/unwind_06.pass.cpp Fri Dec 23 18:37:13 2016
@@ -101,9 +101,9 @@ double try7(bool v) {
   double g = get(0);
   double h = get(0);
   for (counter = 100; counter; --counter)
-    a += get(1) + b+c+d+e+f+g;
+    a += get(1) + b+c+d+e+f+g+h;
   if (v) throw 10;
-  return get(0)+a+b+c+d+e+f+g;
+  return get(0)+a+b+c+d+e+f+g+h;
 }
 
 double try8(bool v) {
@@ -117,9 +117,9 @@ double try8(bool v) {
   double h = get(0);
   double i = get(0);
   for (counter = 100; counter; --counter)
-    a += get(1) + b+c+d+e+f+g+i;
+    a += get(1) + b+c+d+e+f+g+h+i;
   if (v) throw 10;
-  return get(0)+a+b+c+d+e+f+g+i;
+  return get(0)+a+b+c+d+e+f+g+h+i;
 }
 
 




More information about the cfe-commits mailing list