[cfe-dev] [llvm-dev] problem (and fix) with -fms-extensions
Marc Espie via cfe-dev
cfe-dev at lists.llvm.org
Wed May 17 18:31:11 PDT 2017
On Wed, May 17, 2017 at 05:31:45PM -0700, Richard Smith wrote:
>
> On 17 May 2017 at 16:24, Marc Espie via cfe-dev
> <[1]cfe-dev at lists.llvm.org> wrote:
>
> On Wed, May 17, 2017 at 03:55:06PM -0700, Reid Kleckner wrote:
> >
> >Â Â On Wed, May 17, 2017 at 3:22 PM, Marc Espie
> <[1][2]espie at nerim.net> wrote:
> >
> >Â Â Â On Wed, May 17, 2017 at 01:01:07PM -0700, Reid Kleckner
> wrote:
> >Â Â Â >
> >Â Â Â >ÃÂ ÃÂ 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:
> >Â Â Â >ÃÂ ÃÂ #if defined(_MSC_EXTENSIONS) &&
> !defined(_WCHAR_T_DEFINED)
> >Â Â Â >
> >Â Â Â Was this added recently ?
> >Â Â Â There is no _MSC_EXTENSIONS in the clang I'm using...
> >
> >Â Â Looks like we only define it for Windows targets.
> >Â Â How about __is_identifier?
> >Â Â $ cat t.cpp
> >Â Â #if !__is_identifier(__wchar_t)
> >Â Â #error "have __wchar_t"
> >Â Â #else
> >Â Â #error "no __wchar_t"
> >Â Â #endif
> Nope, that will trigger errors on non clang compilers.
>
> You can wrap it in #ifdef __clang__ to fix that.
> Â
And that leads to more or less the same shitty set of conditionals I already
posted about... as opposed to using _MSC_EXTENSIONS, which by the way is
already defined on windows, is unlikely to ever collide with anything, and
would only be on with -fms-extensions, which is not the most common option
ever...
In every single case, __is_identifier will replace a one-liner
with several lines of nested conditionals... not a good thing.
More information about the cfe-dev
mailing list