Specify AO_fetch_and_add/sub1 result is unused in test_atomic
authorIvan Maidanski <ivmai@mail.ru>
Thu, 18 Oct 2012 15:53:34 +0000 (19:53 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 18 Oct 2012 15:53:34 +0000 (19:53 +0400)
* tests/test_atomic.c (add1sub1_thr): Explicitly cast result of
AO_fetch_and_sub1 and AO_fetch_and_add1 to void (to outline that the
result is unused intentionally); reformat code.

tests/test_atomic.c

index 30dbc05..6ce690a 100644 (file)
@@ -44,11 +44,11 @@ void * add1sub1_thr(void * id)
   int i;
 
   for (i = 0; i < NITERS; ++i)
-    if (me & 1)
-      AO_fetch_and_sub1(&counter);
-    else
-      AO_fetch_and_add1(&counter);
-
+    if ((me & 1) != 0) {
+      (void)AO_fetch_and_sub1(&counter);
+    } else {
+      (void)AO_fetch_and_add1(&counter);
+    }
   return 0;
 }