[cfe-dev] Clang-cl.exe and the VC++ preprocessor
Aaron Ballman
aaron at aaronballman.com
Thu Jul 10 13:08:28 PDT 2014
On Thu, Jul 10, 2014 at 3:55 PM, Edward Diener
<eldlistmailingz at tropicsoft.com> wrote:
> I have been told, via my bug report on a preprocessor error in the latest
> version of clang-cl.exe, that clang-cl.exe is trying to emulate at least
> some of the bugs of the VC++ preprocessor.
>
> NO ! Please do not do that.
>
> I know, from having worked on variadic macros in Boost PP and having created
> my own variadic macro data library, how broken the VC++ preprocessor is when
> it comes to preprocessor metaprogramming. Paul Mensonides, the creator of
> Boost PP and an exceptional expert on the C++ preprocessor, also knows and
> has bemoaned countless times how difficult it is to do preprocessor
> metaprogramming if one has to deal with the VC++ preprocessor. Not only will
> clang-cl.exe's emulation of the brokeness of the VC++ preprocessor set back
> further efforts in metaprogramming preprocessor code and libraries but there
> is absolutely no chance, if it means anything to clang-cl developers, that
> any effort will be made to accomodate clang-cl's preprocessor bugs into
> Boost PP ( or my own variadic macro data library ).
>
> This is completely the wrong direction for clang-cl to go. Please stop and
> only consider producing as close to as possible a 100% C++ conformant
> preprocessor, as the rest of clang no doubt has as its goal.
I have the opposite view. Having an MSVC-compatible preprocessor is an
excellent thing for interoperability on the platform. It increases the
likelihood of adopting clang as a native toolset on Windows, and
reduces the barrier to entry, because it allows me to take code which
compiles with MSVC and instead run it through clang.
This functionality is behind a flag (-fms-compatibility), and it would
be a step backwards to say "please turn on compatibility with MSVC,
except for the preprocessor" when that flag is enabled. It would also
prevent using MSVC's STL (IIRC, <type_traits> relies on this behavior
in MSVC 2012 due to the compiler's lack of support for variadic
templates).
I would not be opposed to a more fine-grained flag that allowed you to
disable the quirks for the processor when -fms-compatibility is turned
on, akin to -fno-delayed-template-parsing.
~Aaron
More information about the cfe-dev
mailing list