Skip to content

Commit a140cba

Browse files
committed
Fix warnings in libc++abi tests
llvm-svn: 290471
1 parent 9e31712 commit a140cba

11 files changed

+42
-39
lines changed

libcxxabi/test/backtrace_test.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <unwind.h>
1515

1616
extern "C" _Unwind_Reason_Code
17-
trace_function(struct _Unwind_Context* context, void* ntraced) {
17+
trace_function(struct _Unwind_Context*, void* ntraced) {
1818
(*reinterpret_cast<size_t*>(ntraced))++;
1919
// We should never have a call stack this deep...
2020
assert(*reinterpret_cast<size_t*>(ntraced) < 20);

libcxxabi/test/cxa_bad_cast.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ int main ()
4040
#endif
4141
Derived &d = test_bad_cast(gB);
4242
assert(false);
43+
((void)d);
4344
#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
4445
} catch (std::bad_cast) {
4546
// success

libcxxabi/test/test_aux_runtime.pass.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ bool bad_typeid_test () {
2828
class B { virtual void g() {}};
2929

3030
B *bp = NULL;
31-
try {bool b = typeid(*bp) == typeid (A); }
32-
catch ( const std::bad_typeid &bc ) { return true; }
31+
try {bool b = typeid(*bp) == typeid (A); ((void)b); }
32+
catch ( const std::bad_typeid &) { return true; }
3333
return false;
3434
}
3535

@@ -44,12 +44,12 @@ bool bad_cast_test () {
4444

4545
D d;
4646
B *bp = (B*)&d; // cast needed to break protection
47-
try { D &dr = dynamic_cast<D&> (*bp); }
48-
catch ( const std::bad_cast &bc ) { return true; }
47+
try { D &dr = dynamic_cast<D&> (*bp); ((void)dr); }
48+
catch ( const std::bad_cast & ) { return true; }
4949
return false;
5050
}
5151

52-
int main ( int argc, char *argv [] ) {
52+
int main ( ) {
5353
int ret_val = 0;
5454

5555
if ( !bad_typeid_test ()) {

libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool bad_array_new_length_test() {
2828
return false;
2929
}
3030

31-
int main(int argc, char *argv []) {
31+
int main() {
3232
int ret_val = 0;
3333

3434
if ( !bad_array_new_length_test ()) {

libcxxabi/test/test_exception_storage.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ size_t thread_globals [ NUMTHREADS ] = { 0 };
4242
__libcxxabi_thread_t threads [ NUMTHREADS ];
4343
#endif
4444

45-
int main ( int argc, char *argv [] ) {
45+
int main () {
4646
int retVal = 0;
4747

4848
#ifndef _LIBCXXABI_HAS_NO_THREADS

libcxxabi/test/test_fallback_malloc.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void exhaustion_test3 () {
165165
}
166166

167167

168-
int main ( int argc, char *argv [] ) {
168+
int main () {
169169
print_free_list ();
170170

171171
char *p = (char *) fallback_malloc ( 1024 ); // too big!

libcxxabi/test/test_guard.pass.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ namespace test1 {
2525
}
2626
void helper() {
2727
static int a = increment();
28+
((void)a);
2829
}
2930
void test() {
30-
static int a = increment();
31+
static int a = increment(); ((void)a);
3132
assert(run_count == 1);
32-
static int b = increment();
33+
static int b = increment(); ((void)b);
3334
assert(run_count == 2);
3435
helper();
3536
assert(run_count == 3);
@@ -50,7 +51,8 @@ namespace test2 {
5051
void helper() {
5152
try {
5253
static int a = increment();
53-
assert(0);
54+
assert(false);
55+
((void)a);
5456
} catch (...) {}
5557
}
5658
void test() {
@@ -71,12 +73,12 @@ namespace test3 {
7173
}
7274

7375
int one() {
74-
static int b = zero();
76+
static int b = zero(); ((void)b);
7577
return 0;
7678
}
7779

7880
void test() {
79-
static int a = one();
81+
static int a = one(); ((void)a);
8082
}
8183
}
8284

@@ -91,7 +93,7 @@ namespace test4 {
9193
}
9294

9395
void helper() {
94-
static int a = increment();
96+
static int a = increment(); ((void)a);
9597
}
9698

9799
void test() {
@@ -112,16 +114,16 @@ namespace test5 {
112114
}
113115

114116
int one() {
115-
static int b = zero();
117+
static int b = zero(); ((void)b);
116118
return 0;
117119
}
118120

119121
void another_helper() {
120-
static int a = one();
122+
static int a = one(); ((void)a);
121123
}
122124

123125
void helper() {
124-
static int a = one();
126+
static int a = one(); ((void)a);
125127
std::thread t(another_helper);
126128
t.join();
127129
}

libcxxabi/test/test_vector1.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ void my_dealloc2 ( void *p ) {
2525
std::free ( p );
2626
}
2727

28-
void my_dealloc3 ( void *p, size_t sz ) {
28+
void my_dealloc3 ( void *p, size_t ) {
2929
// std::printf ( "Freeing %lx (size %ld)\n", (unsigned long) p, sz );
3030
std::free ( p );
3131
}
3232

33-
void my_construct ( void *p ) {
33+
void my_construct ( void * ) {
3434
// std::printf ( "Constructing %lx\n", (unsigned long) p );
3535
}
3636

37-
void my_destruct ( void *p ) {
37+
void my_destruct ( void * ) {
3838
// std::printf ( "Destructing %lx\n", (unsigned long) p );
3939
}
4040

4141
int gCounter;
42-
void count_construct ( void *p ) { ++gCounter; }
43-
void count_destruct ( void *p ) { --gCounter; }
42+
void count_construct ( void * ) { ++gCounter; }
43+
void count_destruct ( void * ) { --gCounter; }
4444

4545

4646
int gConstructorCounter;
4747
int gConstructorThrowTarget;
4848
int gDestructorCounter;
4949
int gDestructorThrowTarget;
50-
void throw_construct ( void *p ) {
50+
void throw_construct ( void * ) {
5151
#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
5252
if ( gConstructorCounter == gConstructorThrowTarget )
5353
throw 1;
5454
++gConstructorCounter;
5555
#endif
5656
}
57-
void throw_destruct ( void *p ) {
57+
void throw_destruct ( void * ) {
5858
#ifndef LIBCXXABI_HAS_NO_EXCEPTIONS
5959
if ( ++gDestructorCounter == gDestructorThrowTarget )
6060
throw 2;
@@ -269,7 +269,7 @@ int test_exception_in_destructor ( ) {
269269
}
270270
#endif
271271

272-
int main ( int argc, char *argv [] ) {
272+
int main () {
273273
int retVal = 0;
274274
retVal += test_empty ();
275275
retVal += test_counted ();

libcxxabi/test/test_vector2.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@ void my_dealloc2 ( void *p ) {
2828
std::free ( p );
2929
}
3030

31-
void my_dealloc3 ( void *p, size_t sz ) {
31+
void my_dealloc3 ( void *p, size_t ) {
3232
// std::printf ( "Freeing %lx (size %ld)\n", (unsigned long) p, sz );
3333
std::free ( p );
3434
}
3535

36-
void my_construct ( void *p ) {
36+
void my_construct ( void *) {
3737
// std::printf ( "Constructing %lx\n", (unsigned long) p );
3838
}
3939

40-
void my_destruct ( void *p ) {
40+
void my_destruct ( void *) {
4141
// std::printf ( "Destructing %lx\n", (unsigned long) p );
4242
}
4343

4444
int gCounter;
45-
void count_construct ( void *p ) { ++gCounter; }
46-
void count_destruct ( void *p ) { --gCounter; }
45+
void count_construct ( void * ) { ++gCounter; }
46+
void count_destruct ( void * ) { --gCounter; }
4747

4848

4949
int gConstructorCounter;
5050
int gConstructorThrowTarget;
5151
int gDestructorCounter;
5252
int gDestructorThrowTarget;
53-
void throw_construct ( void *p ) { if ( gConstructorCounter == gConstructorThrowTarget ) throw 1; ++gConstructorCounter; }
54-
void throw_destruct ( void *p ) { if ( ++gDestructorCounter == gDestructorThrowTarget ) throw 2; }
53+
void throw_construct ( void * ) { if ( gConstructorCounter == gConstructorThrowTarget ) throw 1; ++gConstructorCounter; }
54+
void throw_destruct ( void * ) { if ( ++gDestructorCounter == gDestructorThrowTarget ) throw 2; }
5555

5656
struct vec_on_stack {
5757
void *storage;
@@ -78,7 +78,7 @@ void test_exception_in_destructor ( ) {
7878

7979

8080

81-
int main ( int argc, char *argv [] ) {
81+
int main () {
8282
std::set_terminate ( my_terminate );
8383
test_exception_in_destructor ();
8484
return 1; // we failed if we get here

libcxxabi/test/test_vector3.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void destroy(void* v)
4848
t->~T();
4949
}
5050

51-
int main( int argc, char *argv [])
51+
int main()
5252
{
5353
std::set_terminate(my_terminate);
5454
{

libcxxabi/test/unwind_06.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ double try7(bool v) {
101101
double g = get(0);
102102
double h = get(0);
103103
for (counter = 100; counter; --counter)
104-
a += get(1) + b+c+d+e+f+g;
104+
a += get(1) + b+c+d+e+f+g+h;
105105
if (v) throw 10;
106-
return get(0)+a+b+c+d+e+f+g;
106+
return get(0)+a+b+c+d+e+f+g+h;
107107
}
108108

109109
double try8(bool v) {
@@ -117,9 +117,9 @@ double try8(bool v) {
117117
double h = get(0);
118118
double i = get(0);
119119
for (counter = 100; counter; --counter)
120-
a += get(1) + b+c+d+e+f+g+i;
120+
a += get(1) + b+c+d+e+f+g+h+i;
121121
if (v) throw 10;
122-
return get(0)+a+b+c+d+e+f+g+i;
122+
return get(0)+a+b+c+d+e+f+g+h+i;
123123
}
124124

125125

0 commit comments

Comments
 (0)