]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't simply break the build if gcc doesn't provide the require primitives on ppc.
authorJulian Seward <jseward@acm.org>
Tue, 21 Oct 2008 23:12:56 +0000 (23:12 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 21 Oct 2008 23:12:56 +0000 (23:12 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8690

helgrind/tests/tc11_XCHG.c

index 28ef78383bd54dac5abbcd391b69498b83e32513..22c6baf355ae934c1777acbecaee10319a3bdb8f 100644 (file)
         : /*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;