Fix warnings in libc++abi tests

llvm-svn: 290471
This commit is contained in:
Eric Fiselier 2016-12-24 00:37:13 +00:00
parent 9e317127ad
commit a140cba795
11 changed files with 42 additions and 39 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 ()) {

View File

@ -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 ()) {

View File

@ -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

View File

@ -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!

View File

@ -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();
}

View File

@ -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 ();

View File

@ -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

View File

@ -48,7 +48,7 @@ void destroy(void* v)
t->~T();
}
int main( int argc, char *argv [])
int main()
{
std::set_terminate(my_terminate);
{

View File

@ -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;
}