Prevent AO_USE_SYNC_CAS_BUILTIN redefinition in atomic_ops.h
authorIvan Maidanski <ivmai@mail.ru>
Thu, 1 Dec 2011 10:41:39 +0000 (14:41 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 1 Dec 2011 10:41:39 +0000 (14:41 +0400)
* src/atomic_ops.h (AO_USE_SYNC_CAS_BUILTIN): Do not redefine if it
is already defined.

src/atomic_ops.h

index 99c66bd..99d927a 100644 (file)
 #   include "atomic_ops/sysdeps/gcc/x86.h"
 # endif /* __i386__ */
 # if defined(__x86_64__)
-#   if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+#   if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) \
+       && !defined(AO_USE_SYNC_CAS_BUILTIN)
       /* It is safe to use __sync CAS built-in on this architecture.    */
 #     define AO_USE_SYNC_CAS_BUILTIN
 #   endif
 #     include "atomic_ops/sysdeps/gcc/x86.h"
 #   endif /* __i386__ */
 #   if defined(__x86_64__)
-#     if __INTEL_COMPILER > 1110
+#     if (__INTEL_COMPILER > 1110) && !defined(AO_USE_SYNC_CAS_BUILTIN)
 #       define AO_USE_SYNC_CAS_BUILTIN
 #     endif
 #     include "atomic_ops/sysdeps/gcc/x86_64.h"