test-atomic: Fix warnings for GCC4.9 and sparse
authorDaniele Di Proietto <ddiproietto@vmware.com>
Thu, 7 Aug 2014 01:35:11 +0000 (01:35 +0000)
committerJarno Rajahalme <jrajahalme@nicira.com>
Wed, 6 Aug 2014 17:58:22 +0000 (10:58 -0700)
There's no reason for the local variable 'old_count' to be atomic. In fact, if
it is atomic it triggers a GCC4.9 warning (Wunused-value)
The global variables 'a' and 'paux' could be static, according to sparse.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
tests/test-atomic.c

index ca293ba..31c06fa 100644 (file)
@@ -167,7 +167,7 @@ test_atomic_flag(void)
     ovs_assert(atomic_flag_test_and_set(&flag) == false);
 }
 
-uint32_t a;
+static uint32_t a;
 
 struct atomic_aux {
     atomic_uint32_t count;
@@ -175,7 +175,7 @@ struct atomic_aux {
     ATOMIC(uint32_t *) data;
 };
 
-ATOMIC(struct atomic_aux *) paux = ATOMIC_VAR_INIT(NULL);
+static ATOMIC(struct atomic_aux *) paux = ATOMIC_VAR_INIT(NULL);
 static struct atomic_aux *auxes = NULL;
 
 #define ATOMIC_ITEM_COUNT 1000000
@@ -273,7 +273,7 @@ static void *
 atomic_writer(void *aux_)
 {
     struct atomic_aux *aux = aux_;
-    atomic_uint32_t old_count;
+    uint32_t old_count;
     uint32_t *data;
     size_t i;