[cfe-commits] adding "-fasan" flag

Kostya Serebryany kcc at google.com
Tue Nov 15 20:46:43 PST 2011


>
>
> See http://clang.llvm.org/docs/LanguageExtensions.html#feature_check --
> it should be completely compiler neutral.
>

So, the user code will have to look like this?

#ifndef __has_feature
# define __has_feature(x) 0
#endif
...

#if __has_feature(address_sanitizer)
..
#endif


Also, is that indeed the right use of __has_feature? Maybe __has_extension
fits better?
Hm, asan is not an extension nor a (C++ standard) feature.

__has_feature evaluates to 1 if the feature is both supported by Clang and
standardized in the current language standard or 0 if not
__has_extension evaluates to 1 if the feature is supported by Clang in the
current language (either as a language extension or a standard language
feature) or 0 if not.

--kcc








> It's just a mechanism that compilers can use to hide feature tests behind
> a known-safe macro, thereby avoiding keyword clobbers etc. GCC could be
> trivially extend to directly support this test pattern, and code can be
> written to work even with compilers that don't support it.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111115/39389d62/attachment.html>


More information about the cfe-commits mailing list