Date: Sat, 21 Dec 2019 02:43:21 +0000 (UTC) From: Ryan Libby <rlibby@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355969 - head/sys/sys Message-ID: <201912210243.xBL2hLnv088204@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rlibby Date: Sat Dec 21 02:43:20 2019 New Revision: 355969 URL: https://svnweb.freebsd.org/changeset/base/355969 Log: gcc: quiet Wattribute for no_sanitize("address") This is an unfortunate instance where the __has_attribute check does not function usefully. Gcc does have the attribute, but for gcc it only applies to functions, not variables, and trying to apply it to a variable generates Wattribute. So far we only apply the attribute to variables. Only enable the attribute for clang, for now. Reviewed by: Anton Rang <rang at acm.org> Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22875 Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sat Dec 21 02:40:40 2019 (r355968) +++ head/sys/sys/cdefs.h Sat Dec 21 02:43:20 2019 (r355969) @@ -873,8 +873,12 @@ /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) -/* Function or variable should not be sanitized, ie. by AddressSanitizer */ -#if __has_attribute(no_sanitize) +/* + * Function or variable should not be sanitized, i.e. by AddressSanitizer. + * GCC has the nosanitize attribute, but as a function attribute only, and + * warns on use as a variable attribute. + */ +#if __has_attribute(no_sanitize) && defined(__clang__) #define __nosanitizeaddress __attribute__((no_sanitize("address"))) #else #define __nosanitizeaddress
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912210243.xBL2hLnv088204>