|
From: <sv...@va...> - 2008-09-09 18:11:33
|
Author: bart
Date: 2008-09-09 19:11:40 +0100 (Tue, 09 Sep 2008)
New Revision: 8593
Log:
Make sure that atomic_var.c compiles without warnings in case HAVE_BUILTIN_ATOMIC has not been defined.
Modified:
trunk/drd/tests/atomic_var.c
Modified: trunk/drd/tests/atomic_var.c
===================================================================
--- trunk/drd/tests/atomic_var.c 2008-09-09 11:10:29 UTC (rev 8592)
+++ trunk/drd/tests/atomic_var.c 2008-09-09 18:11:40 UTC (rev 8593)
@@ -26,6 +26,7 @@
#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 @@
fprintf(stderr, "y = %d\n", s_y);
return 0;
}
+#endif
int main(int argc, char** argv)
{
@@ -59,14 +61,14 @@
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;
}
|