summaryrefslogtreecommitdiff
path: root/tests/test_malloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-08-04 22:49:51 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-08-04 22:49:51 +0400
commit9b32643f567b6d65fff59c60fae7346374ef7970 (patch)
treefbd5f4560b241ea5daf519a181d45776ed38d39b /tests/test_malloc.c
parent5757ba9ea26b34f762357567fadacd2ef6263496 (diff)
downloadlibatomic_ops-9b32643f567b6d65fff59c60fae7346374ef7970.tar.gz
Fix compiler extra warnings.
* src/atomic_ops_stack.c (AO_stack_pop_explicit_aux_acquire): Remove non-negative-value test for an unsigned value. * src/atomic_ops_stack.h (AO_STACK_INITIALIZER): Add {} to match type definition. * tests/test_atomic.c (acqrel_thr): Fix code indentation. * tests/test_atomic.c (test_and_set_thr): Print thread Id in case of error. * tests/test_malloc.c (cons): Declare "i" local variable as unsigned (as it is compared to another unsigned value). * tests/test_malloc.c (check_list): Test upper bound as well, abort with the appropriate message in case of mismatch. * tests/test_malloc.c (run_one_test): Return "arg" parameter (to suppress "unused parameter" compiler warning).
Diffstat (limited to 'tests/test_malloc.c')
-rw-r--r--tests/test_malloc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/test_malloc.c b/tests/test_malloc.c
index 4bf6e6c..6341942 100644
--- a/tests/test_malloc.c
+++ b/tests/test_malloc.c
@@ -63,7 +63,7 @@ ln *cons(int d, ln *tail)
size_t my_extra = extra;
ln *result;
int * extras;
- int i;
+ unsigned i;
if (my_extra > 100)
extra = my_extra = 0;
@@ -101,7 +101,7 @@ void check_list(ln *l, int m, int n)
ln *p;
int i;
- for (p = l, i = m; p != 0; p = p -> next, ++i)
+ for (p = l, i = m; p != 0 && i <= n; p = p -> next, ++i)
{
if (i != p -> data)
{
@@ -109,6 +109,16 @@ void check_list(ln *l, int m, int n)
abort();
}
}
+ if (i <= n)
+ {
+ fprintf(stderr, "Number not found: %d\n", i);
+ abort();
+ }
+ if (p != 0)
+ {
+ fprintf(stderr, "Found unexpected number: %d\n", i);
+ abort();
+ }
}
/* Create a list of integers from m to n */
@@ -180,7 +190,7 @@ void * run_one_test(void * arg) {
x = reverse(x, 0);
}
check_list(x, 1, LIST_LENGTH);
- return 0;
+ return arg; /* use arg to suppress compiler warning */
}
int main(int argc, char **argv) {