<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 17, 2017 at 4:35 PM, Marc Espie <span dir="ltr"><<a href="mailto:espie@nerim.net" target="_blank">espie@nerim.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, May 17, 2017 at 03:55:06PM -0700, Reid Kleckner wrote:<br>
<span class="gmail-">><br>
>    On Wed, May 17, 2017 at 3:22 PM, Marc Espie <[1]<a href="mailto:espie@nerim.net">espie@nerim.net</a>> wrote:<br>
><br>
>      On Wed, May 17, 2017 at 01:01:07PM -0700, Reid Kleckner wrote:<br>
>      ><br>
</span>>      >  Â  I'd rather not add new pre-defined macros if we can avoid it.<br>
>      There are<br>
>      >  Â  already too many. You can probably detect this situation<br>
>      with:<br>
>      >  Â  #if defined(_MSC_EXTENSIONS) && !defined(_WCHAR_T_DEFINED)<br>
<span class="gmail-">>      ><br>
>      Was this added recently ?<br>
>      There is no _MSC_EXTENSIONS in the clang I'm using...<br>
><br>
>    Looks like we only define it for Windows targets.<br>
>    How about __is_identifier?<br>
<br>
</span>Or, what's the problem with moving _MSC_EXTENSIONS to be for all targets.<br>
<br>
<br>
Look, this stuff is highly specific, I doubt many people are going to<br>
use -fms-extensions who don't know what they're doing.<br>
E.g., the exposure to _MSC_EXTENSIONS will be minimal.<br>
<br>
Having a single define will mean replacing (for us)<br>
<span class="gmail-">#ifndef __cplusplus<br>
typedef int                     __wchar_t;<br>
#endif<br>
<br>
</span>with<br>
#if !defined(__cplusplus) && !defined(_MSC_EXTENSIONS)<br>
typedef int                     __wchar_t;<br>
#endif<br>
<br>
which is fairly acceptable.<br>
<br>
Playing with __is_identifier is rather more awful, because there is no<br>
simple construct, we can't simply write:<br>
#if !defined(__cplusplus) || __is_identifier(__wchar_t)<br>
because  this *also* has to work with other compilers, some of which<br>
do not understand __is_identifier at all, so it can't be a single test<br>
then.<br>
<br>
It would become some atrocity like<br>
<br>
#if !defined(__cplusplus)<br>
# if defined(__is_identifier)<br>
#  if __is_identifier(__wchar_t)<br>
#  else<br>
typedef int     __wchar_t;<br>
#  endif<br>
# else<br>
typedef int     __wchar_t;<br>
# endif<br>
#endif<br>
<br>
And that has about zero chance to ever be committed in our tree,<br>
especially since this is in a md _types.h file, so this construct x10 times<br>
in the tree.<br>
</blockquote></div><br></div><div class="gmail_extra"><div class="gmail_extra">So, we actually have documentation on this, and __wchar_t is the example use case:</div><div class="gmail_extra"><a href="https://clang.llvm.org/docs/LanguageExtensions.html#is-identifier">https://clang.llvm.org/docs/LanguageExtensions.html#is-identifier</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Please just use it, it works.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I do not want to define _MSC_EXTENSIONS more than we already do, and I don't think we should add more pre-defined macros when we already have these nicely factored feature test macros that don't pollute the global namespace. The "simple solution" is not a good solution.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I believe our use of _MSC_EXTENSIONS is wrong anyway. It is controlled by MSVC's /Ze and /Za flags, which do not relate to our -fms-extensions flag.</div></div></div>