summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-24 00:37:13 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-24 00:37:13 +0000
commit08bf03cf8ca8a4f55644956aec77677b3f0cf232 (patch)
tree896f39c9a0baca1fb5f4710d3a8efcf7f737d100 /test
parent534295b102a7f9951ab2b8b38637b9cdf57cade1 (diff)
Fix warnings in libc++abi tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@290471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/backtrace_test.pass.cpp2
-rw-r--r--test/cxa_bad_cast.pass.cpp1
-rw-r--r--test/test_aux_runtime.pass.cpp10
-rw-r--r--test/test_aux_runtime_op_array_new.pass.cpp2
-rw-r--r--test/test_exception_storage.pass.cpp2
-rw-r--r--test/test_fallback_malloc.pass.cpp2
-rw-r--r--test/test_guard.pass.cpp20
-rw-r--r--test/test_vector1.pass.cpp16
-rw-r--r--test/test_vector2.pass.cpp16
-rw-r--r--test/test_vector3.pass.cpp2
-rw-r--r--test/unwind_06.pass.cpp8
11 files changed, 42 insertions, 39 deletions
diff --git a/test/backtrace_test.pass.cpp b/test/backtrace_test.pass.cpp
index 80346c0..b9388ff 100644
--- a/test/backtrace_test.pass.cpp
+++ b/test/backtrace_test.pass.cpp
@@ -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);
diff --git a/test/cxa_bad_cast.pass.cpp b/test/cxa_bad_cast.pass.cpp
index c863d6f..d2c3bf9 100644
--- a/test/cxa_bad_cast.pass.cpp
+++ b/test/cxa_bad_cast.pass.cpp
@@ -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
diff --git a/test/test_aux_runtime.pass.cpp b/test/test_aux_runtime.pass.cpp
index a9f240e..0c9a8f2 100644
--- a/test/test_aux_runtime.pass.cpp
+++ b/test/test_aux_runtime.pass.cpp
@@ -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 ()) {
diff --git a/test/test_aux_runtime_op_array_new.pass.cpp b/test/test_aux_runtime_op_array_new.pass.cpp
index 701a457..d4a63d7 100644
--- a/test/test_aux_runtime_op_array_new.pass.cpp
+++ b/test/test_aux_runtime_op_array_new.pass.cpp
@@ -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 ()) {
diff --git a/test/test_exception_storage.pass.cpp b/test/test_exception_storage.pass.cpp
index d509227..13a4a60 100644
--- a/test/test_exception_storage.pass.cpp
+++ b/test/test_exception_storage.pass.cpp
@@ -42,7 +42,7 @@ size_t thread_globals [ NUMTHREADS ] = { 0 };
__libcxxabi_thread_t threads [ NUMTHREADS ];
#endif
-int main ( int argc, char *argv [] ) {
+int main () {
int retVal = 0;
#ifndef _LIBCXXABI_HAS_NO_THREADS
diff --git a/test/test_fallback_malloc.pass.cpp b/test/test_fallback_malloc.pass.cpp
index 250a738..734a276 100644
--- a/test/test_fallback_malloc.pass.cpp
+++ b/test/test_fallback_malloc.pass.cpp
@@ -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!
diff --git a/test/test_guard.pass.cpp b/test/test_guard.pass.cpp
index 2312b51..ef86717 100644
--- a/test/test_guard.pass.cpp
+++ b/test/test_guard.pass.cpp
@@ -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();
}
diff --git a/test/test_vector1.pass.cpp b/test/test_vector1.pass.cpp
index 978ed3c..0f3acd2 100644
--- a/test/test_vector1.pass.cpp
+++ b/test/test_vector1.pass.cpp
@@ -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 ();
diff --git a/test/test_vector2.pass.cpp b/test/test_vector2.pass.cpp
index 4bc279d..5a5ff06 100644
--- a/test/test_vector2.pass.cpp
+++ b/test/test_vector2.pass.cpp
@@ -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
diff --git a/test/test_vector3.pass.cpp b/test/test_vector3.pass.cpp
index a817125..2f983ef 100644
--- a/test/test_vector3.pass.cpp
+++ b/test/test_vector3.pass.cpp
@@ -48,7 +48,7 @@ void destroy(void* v)
t->~T();
}
-int main( int argc, char *argv [])
+int main()
{
std::set_terminate(my_terminate);
{
diff --git a/test/unwind_06.pass.cpp b/test/unwind_06.pass.cpp
index a30efb1..e712566 100644
--- a/test/unwind_06.pass.cpp
+++ b/test/unwind_06.pass.cpp
@@ -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;
}