[ASan] don't use attribute no_address_safety_analysis if it's unknown to compiler
authorAlexey Samsonov <samsonov@google.com>
Wed, 17 Oct 2012 13:19:59 +0000 (13:19 +0000)
committerAlexey Samsonov <samsonov@google.com>
Wed, 17 Oct 2012 13:19:59 +0000 (13:19 +0000)
llvm-svn: 166099

compiler-rt/lib/asan/tests/asan_test.cc
compiler-rt/lib/asan/tests/asan_test_utils.h

index 473e04c..569564d 100644 (file)
@@ -1811,7 +1811,7 @@ TEST(AddressSanitizer, LargeStructCopyTest) {
   *Ident(&a) = *Ident(&a);
 }
 
-__attribute__((no_address_safety_analysis))
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
 static void NoAddressSafety() {
   char *foo = new char[10];
   Ident(foo)[10] = 0;
index b7805cd..577a7eb 100644 (file)
@@ -38,6 +38,13 @@ typedef __int64          int64_t;
 #define __has_feature(x) 0
 #endif
 
+#if __has_feature(address_sanitizer)
+# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
+    __attribute__((no_address_safety_analysis))
+#else
+# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+#endif
+
 #ifndef __WORDSIZE
 #if __LP64__ || defined(_WIN64)
 #define __WORDSIZE 64