From: Julian Seward Date: Tue, 21 Oct 2008 23:12:56 +0000 (+0000) Subject: Don't simply break the build if gcc doesn't provide the require primitives on ppc. X-Git-Tag: svn/VALGRIND_3_4_0~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34c70c59ea31ed02b453f165e390adabd3ded8cf;p=thirdparty%2Fvalgrind.git Don't simply break the build if gcc doesn't provide the require primitives on ppc. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8690 --- diff --git a/helgrind/tests/tc11_XCHG.c b/helgrind/tests/tc11_XCHG.c index 28ef78383b..22c6baf355 100644 --- a/helgrind/tests/tc11_XCHG.c +++ b/helgrind/tests/tc11_XCHG.c @@ -46,30 +46,33 @@ : /*in*/ "m"(_addr) \ : "memory", "cc" \ ) + #elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \ || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5) -#ifdef HAVE_BUILTIN_ATOMIC -# define XCHG_M_R(_addr,_lval) \ - do { \ - int tmp; \ - while ((tmp = *(int*)(& _addr)), \ - ! __sync_bool_compare_and_swap((int*)&_addr, tmp, _lval)) \ - ; \ - _lval = tmp; \ - } while (0) -#else -#error "XCHG_M_R() implementation is missing. Either provide one or use a newer gcc version." -#endif +# if defined(HAVE_BUILTIN_ATOMIC) +# define XCHG_M_R(_addr,_lval) \ + do { \ + int tmp; \ + while ((tmp = *(int*)(& _addr)), \ + ! __sync_bool_compare_and_swap((int*)&_addr, tmp, _lval)) \ + ; \ + _lval = tmp; \ + } while (0) +# else +# warning "XCHG_M_R() implementation is missing. Either" \ + "provide one or use a newer gcc version." +# define XCHG_M_R(_addr,_lval) \ + do { int tmp = *(int*)(& _addr); \ + *(int*)(& _addr) = (_lval); \ + _lval = tmp; \ + } while (0) +# endif # define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \ XCHG_M_R(_addr,_lval) + #else -# define XCHG_M_R(_addr,_lval) \ - do { int tmp = *(int*)(& _addr); \ - *(int*)(& _addr) = (_lval); \ - _lval = tmp; \ - } while (0) -# define XCHG_M_R_with_redundant_LOCK(_addr,_lval) \ - XCHG_M_R(_addr,_lval) +# error "Unsupported architecture" + #endif int x = 0;