Fix 'unknown attribute no_sanitize' compiler warnings for GCC
authorIvan Maidanski <ivmai@mail.ru>
Mon, 20 Nov 2017 21:17:51 +0000 (00:17 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 21 Nov 2017 07:58:18 +0000 (10:58 +0300)
(fix commits ce75cf1, b850e1c)

* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_ADDR
&& ADDRESS_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_ADDR): Define to
__attribute__((no_sanitize_address)).
* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_MEMORY
&& MEMORY_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_MEMORY): Define to
__attribute__((no_sanitize_memory)).
* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_THREAD
&& THREAD_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_THREAD): Define to
__attribute__((no_sanitize_thread)).

include/private/gc_priv.h

index 83298d6..5fe89f6 100644 (file)
@@ -155,26 +155,32 @@ typedef char * ptr_t;   /* A generic pointer to which we can add        */
 #endif
 
 #ifndef GC_ATTR_NO_SANITIZE_ADDR
-# ifdef ADDRESS_SANITIZER
+# ifndef ADDRESS_SANITIZER
+#   define GC_ATTR_NO_SANITIZE_ADDR /* empty */
+# elif GC_CLANG_PREREQ(3, 8)
 #   define GC_ATTR_NO_SANITIZE_ADDR __attribute__((no_sanitize("address")))
 # else
-#   define GC_ATTR_NO_SANITIZE_ADDR /* empty */
+#   define GC_ATTR_NO_SANITIZE_ADDR __attribute__((no_sanitize_address))
 # endif
 #endif /* !GC_ATTR_NO_SANITIZE_ADDR */
 
 #ifndef GC_ATTR_NO_SANITIZE_MEMORY
-# ifdef MEMORY_SANITIZER
+# ifndef MEMORY_SANITIZER
+#   define GC_ATTR_NO_SANITIZE_MEMORY /* empty */
+# elif GC_CLANG_PREREQ(3, 8)
 #   define GC_ATTR_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
 # else
-#   define GC_ATTR_NO_SANITIZE_MEMORY /* empty */
+#   define GC_ATTR_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
 # endif
 #endif /* !GC_ATTR_NO_SANITIZE_MEMORY */
 
 #ifndef GC_ATTR_NO_SANITIZE_THREAD
-# ifdef THREAD_SANITIZER
+# ifndef THREAD_SANITIZER
+#   define GC_ATTR_NO_SANITIZE_THREAD /* empty */
+# elif GC_CLANG_PREREQ(3, 8)
 #   define GC_ATTR_NO_SANITIZE_THREAD __attribute__((no_sanitize("thread")))
 # else
-#   define GC_ATTR_NO_SANITIZE_THREAD /* empty */
+#   define GC_ATTR_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
 # endif
 #endif /* !GC_ATTR_NO_SANITIZE_THREAD */