<div dir="ltr">I'd rather not add new pre-defined macros if we can avoid it. There are already too many. You can probably detect this situation with:<div>#if defined(_MSC_EXTENSIONS) && !defined(_WCHAR_T_DEFINED)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 13, 2017 at 9:02 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, May 12, 2017 at 08:53:53AM -0700, Reid Kleckner wrote:<br>
><br>
> Moving to cfe-dev to discuss clang things.<br>
</span>> I think we already have _WCHAR_T_DEFINED for this:<br>
> Â if (LangOpts.MicrosoftExt) {<br>
> Â Â if (LangOpts.WChar) {<br>
> Â Â Â // wchar_t supported as a keyword.<br>
> Â Â Â Builder.defineMacro("_WCHAR_T_<wbr>DEFINED");<br>
> Â Â Â Builder.defineMacro("_NATIVE_<wbr>WCHAR_T_DEFINED");<br>
> Â Â }<br>
> Â }<br>
<br>
Nope. I'm talking about the __wchar_t type.<br>
In my case, even a C language "hello world" won't compile:<br>
<br>
nausicaa$ clang -fms-extensions a.c<br>
In file included from a.c:1:<br>
In file included from /usr/include/stdio.h:43:<br>
In file included from /usr/include/sys/_types.h:37:<br>
/usr/include/machine/_types.h:<wbr>132:15: error: cannot combine with previous 'int'<br>
declaration specifier<br>
typedef int __wchar_t;<br>
^<br>
1 error generated.<br>
<br>
but actually based on the existing code, I would suggest following<br>
the pattern.<br>
<br>
my main concern would be: are names with ___ readable, or is there<br>
a suggestion for better names ?<br>
<br>
Index: InitPreprocessor.cpp<br>
==============================<wbr>==============================<wbr>=======<br>
RCS file: /cvs/src/gnu/llvm/tools/clang/<wbr>lib/Frontend/InitPreprocessor.<wbr>cpp,v<br>
<span class="">retrieving revision 1.1.1.4<br>
diff -u -p -r1.1.1.4 InitPreprocessor.cpp<br>
</span>--- InitPreprocessor.cpp 14 Mar 2017 08:07:56 -0000 1.1.1.4<br>
+++ InitPreprocessor.cpp 13 May 2017 15:59:14 -0000<br>
@@ -666,6 +668,10 @@ static void InitializePredefinedMacros(c<br>
<span class=""> // wchar_t supported as a keyword.<br>
Builder.defineMacro("_WCHAR_T_<wbr>DEFINED");<br>
Builder.defineMacro("_NATIVE_<wbr>WCHAR_T_DEFINED");<br>
</span>+ } else {<br>
+ // __wchar_t supported as a keyword<br>
+ Builder.defineMacro("___WCHAR_<wbr>T_DEFINED");<br>
+ Builder.defineMacro("_NATIVE__<wbr>_WCHAR_T_DEFINED");<br>
}<br>
}<br>
<br>
</blockquote></div><br></div>