From fe4610b3014b1de2e60c681cbd813bb18ff2afc8 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 22 Mar 2003 23:38:18 +0000 Subject: * include/atomic.h: Put parens around all macro arguments. (__atomic_val_bysize, __atomic_bool_bysize): New macros. (atomic_compare_and_exchange_val_acq): Use it. (atomic_compare_and_exchange_bool_acq): Likewise. (atomic_increment_and_test): Invert sense of test. (atomic_decrement_and_test): Likewise. * csu/tst-atomic.c: Update those tests to match. --- csu/tst-atomic.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'csu/tst-atomic.c') diff --git a/csu/tst-atomic.c b/csu/tst-atomic.c index 727229eaf7..292f6e7334 100644 --- a/csu/tst-atomic.c +++ b/csu/tst-atomic.c @@ -99,7 +99,7 @@ do_test (void) } mem = 0; - if (! atomic_increment_and_test (&mem) + if (atomic_increment_and_test (&mem) || mem != 1) { puts ("atomic_increment_and_test test 1 failed"); @@ -114,6 +114,14 @@ do_test (void) ret = 1; } + mem = -1; + if (! atomic_increment_and_test (&mem) + || mem != 0) + { + puts ("atomic_increment_and_test test 3 failed"); + ret = 1; + } + mem = 17; atomic_decrement (&mem); if (mem != 16) @@ -123,7 +131,7 @@ do_test (void) } mem = 0; - if (! atomic_decrement_and_test (&mem) + if (atomic_decrement_and_test (&mem) || mem != -1) { puts ("atomic_decrement_and_test test 1 failed"); @@ -138,6 +146,14 @@ do_test (void) ret = 1; } + mem = 1; + if (! atomic_decrement_and_test (&mem) + || mem != 0) + { + puts ("atomic_decrement_and_test test 1 failed"); + ret = 1; + } + mem = 1; if (atomic_decrement_if_positive (&mem) != 1 || mem != 0) -- cgit v1.2.3