diff options
author | Roland McGrath <roland@gnu.org> | 2003-03-22 23:38:18 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2003-03-22 23:38:18 +0000 |
commit | fe4610b3014b1de2e60c681cbd813bb18ff2afc8 (patch) | |
tree | 46a2ebdd352177f45bd9f96913f53c30bafa6a54 /csu/tst-atomic.c | |
parent | d15851ec24d31ccf3ee9a4a388104974d1f494dc (diff) | |
download | glibc-fe4610b3014b1de2e60c681cbd813bb18ff2afc8.tar.gz |
* 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.
Diffstat (limited to 'csu/tst-atomic.c')
-rw-r--r-- | csu/tst-atomic.c | 20 |
1 files changed, 18 insertions, 2 deletions
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"); @@ -139,6 +147,14 @@ do_test (void) } 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) { |