[cfe-commits] adding "-fasan" flag

Chandler Carruth chandlerc at google.com
Tue Nov 15 20:51:59 PST 2011


On Tue, Nov 15, 2011 at 8:46 PM, Kostya Serebryany <kcc at google.com> wrote:

>
>> 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
>

I would hope it could be simplified as:

#if defined(__has_feature) && __has_feature(address_sanitizer)
...
#endif

But either way, yes in essence.


> 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.
>

This is a good point. I wonder if there needs to be another __has_* macro
John? (maybe Doug?) I don't know what to call it. It's a feature which is
not related to the standard in any way.

There are other things that I can conceive of wanting to put here:
-fcatch-undefined-behavior, -ftrapv, etc...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111115/7431f2c2/attachment.html>


More information about the cfe-commits mailing list