<div class="gmail_quote">On Tue, Nov 15, 2011 at 8:46 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div><div><br></div></div></div><div>See <a href="http://clang.llvm.org/docs/LanguageExtensions.html#feature_check" target="_blank">http://clang.llvm.org/docs/LanguageExtensions.html#feature_check</a> -- it should be completely compiler neutral. </div>

</div></blockquote><div><br></div></div><div>So, the user code will have to look like this? </div><div><br></div><div>#ifndef __has_feature</div><div># define __has_feature(x) 0</div><div>#endif</div><div>...</div><div><br>
</div>
<div>#if __has_feature(address_sanitizer)</div><div>..</div><div>#endif</div></div></blockquote><div><br></div><div>I would hope it could be simplified as:</div><div><br></div><div>#if defined(__has_feature) && __has_feature(address_sanitizer)</div>
<div>...</div><div>#endif</div><div><br></div><div>But either way, yes in essence.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote">
<div>Also, is that indeed the right use of __has_feature? Maybe __has_extension fits better?  </div><div>Hm, asan is not an extension nor a (C++ standard) feature. </div></div></blockquote><div><br></div><div>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.</div>
<div><br></div><div>There are other things that I can conceive of wanting to put here: -fcatch-undefined-behavior, -ftrapv, etc...</div></div>