From: Bart Van Assche Date: Tue, 9 Sep 2008 18:11:40 +0000 (+0000) Subject: Make sure that atomic_var.c compiles without warnings in case HAVE_BUILTIN_ATOMIC... X-Git-Tag: svn/VALGRIND_3_4_0~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5582ca59016cc5ff61561b2ee91b63f55980a43b;p=thirdparty%2Fvalgrind.git Make sure that atomic_var.c compiles without warnings in case HAVE_BUILTIN_ATOMIC has not been defined. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8593 --- diff --git a/drd/tests/atomic_var.c b/drd/tests/atomic_var.c index a4c6c8f17e..31adb8fe39 100644 --- a/drd/tests/atomic_var.c +++ b/drd/tests/atomic_var.c @@ -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; }