]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: Define BFD_ASAN to detect asan
authorAlan Modra <amodra@gmail.com>
Tue, 3 Mar 2026 02:10:18 +0000 (12:40 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Mar 2026 02:15:31 +0000 (12:45 +1030)
Avoid a complaint from older preprocessors about a "missing binary
operator" between an undefined __has_feature macro and its parameter.

bfd/bfd-in.h
bfd/bfd-in2.h

index 8650fa12d820175d46db4c4e4c55081da075fa2b..8fd45e82c51a4db38a487c7c742bb7936123d96c 100644 (file)
@@ -153,10 +153,16 @@ struct orl;
 
 /* Detect whether we are compiling with -fsanitize=address.  */
 #ifndef BFD_ASAN
-# if ((defined (__SANITIZE_ADDRESS__) && __SANITIZE_ADDRESS__)         \
-      || (defined __has_feature && __has_feature (address_sanitizer)))
+/* gcc.  */
+# if defined __SANITIZE_ADDRESS__
 #  define BFD_ASAN 1
-# else
+/* clang.  */
+# elif defined __has_feature
+#  if __has_feature(address_sanitizer)
+#   define BFD_ASAN 1
+#  endif
+# endif
+# ifndef BFD_ASAN
 #  define BFD_ASAN 0
 # endif
 #endif
index cd5307beef4fec93244d20b5168483ab35a27d43..7e8d0e4053e27e6cd1a0d760cc6b6ef5dab5b12c 100644 (file)
@@ -160,10 +160,16 @@ struct orl;
 
 /* Detect whether we are compiling with -fsanitize=address.  */
 #ifndef BFD_ASAN
-# if ((defined (__SANITIZE_ADDRESS__) && __SANITIZE_ADDRESS__)         \
-      || (defined __has_feature && __has_feature (address_sanitizer)))
+/* gcc.  */
+# if defined __SANITIZE_ADDRESS__
 #  define BFD_ASAN 1
-# else
+/* clang.  */
+# elif defined __has_feature
+#  if __has_feature(address_sanitizer)
+#   define BFD_ASAN 1
+#  endif
+# endif
+# ifndef BFD_ASAN
 #  define BFD_ASAN 0
 # endif
 #endif