]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make sure that atomic_var.c compiles without warnings in case HAVE_BUILTIN_ATOMIC...
authorBart Van Assche <bvanassche@acm.org>
Tue, 9 Sep 2008 18:11:40 +0000 (18:11 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 9 Sep 2008 18:11:40 +0000 (18:11 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8593

drd/tests/atomic_var.c

index a4c6c8f17ee10b971c880b474cb514611c53bb2f..31adb8fe39f1344052c001f39ffd4766d2ac1d56 100644 (file)
@@ -26,6 +26,7 @@ int __sync_add_and_fetch(int* p, int i)
 #endif
 
 
+#ifdef HAVE_BUILTIN_ATOMIC
 static int s_x = 0;
 /* s_dummy[] ensures that s_x and s_y are not in the same cache line. */
 static char s_dummy[512];
@@ -45,6 +46,7 @@ static void* thread_func_2(void* arg)
   fprintf(stderr, "y = %d\n", s_y);
   return 0;
 }
+#endif
 
 int main(int argc, char** argv)
 {
@@ -59,14 +61,14 @@ int main(int argc, char** argv)
   for (i = 0; i < n_threads; i++)
     pthread_join(tid[i], 0);
   fprintf(stderr, "Test finished.\n");
+
+  /* Suppress the compiler warning about s_dummy not being used. */
+  s_dummy[0]++;
 #else
   fprintf(stderr,
           "Sorry, but your compiler does not have built-in support for atomic"
           " operations.\n");
 #endif
 
-  /* Suppress the compiler warning about s_dummy not being used. */
-  s_dummy[0]++;
-
   return 0;
 }