[compiler-rt] 029005a - [NFC][sanitizer] Fix 'macro redefined' warning in test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun May 16 19:11:17 PDT 2021


Author: Vitaly Buka
Date: 2021-05-16T19:11:07-07:00
New Revision: 029005a2e20fe65f850bd000d0d71008eff669ed

URL: https://github.com/llvm/llvm-project/commit/029005a2e20fe65f850bd000d0d71008eff669ed
DIFF: https://github.com/llvm/llvm-project/commit/029005a2e20fe65f850bd000d0d71008eff669ed.diff

LOG: [NFC][sanitizer] Fix 'macro redefined' warning in test

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
index 574b4f5d4e062..a3e309fdbd3ac 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
@@ -16,12 +16,14 @@
 #define __has_extension(x) 0
 #endif
 
-#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
-#define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
-#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
-#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
-#else
-#error Unsupported compiler.
+#ifndef ATOMIC_LLONG_LOCK_FREE
+#  if __has_extension(c_atomic) || __has_extension(cxx_atomic)
+#    define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
+#  elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+#    define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+#  else
+#    error Unsupported compiler.
+#  endif
 #endif
 
 namespace __sanitizer {


        


More information about the llvm-commits mailing list