Boost logo

Boost :

Subject: [boost] [clang][preprocessor] Testing of clang emualting the VC++ preprocessor on Windows
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-03-30 17:05:17

I have made local changes in the Boost preprocessor config.hpp on the
'develop' branch to have clang's emulation of the non-standard VC++
preprocessor act like the VC++ preprocessor as far as Boost PP is
concerned. Boost PP has a large number of workarounds for VC++ without
which Boost PP preprocessor code would not work when compiling using any
version of VC++.

I have tested the usual compilers extensively to make sure they are
unaffected by these changes as well as the normal clang-linux
implementation. Everything remains the same for these compilers with my
changes so I am assured the changes will not affect any other compiler

I was able to test both clang-3.8 and the latest build of clang, which
is clang-3.9, by invoking clang-cl. My user-config.jam file for these
entries looks like:

using clang-win : 3.8 : SomePath/clang-cl : <compatibility>vc12
using clang-win : 3.9 : SomePath/clang-cl : <compatibility>vc14

By passing toolset=clang-win-3.8 or toolset=clang-win-3.9 I was able to
successfully test these implementations against the Boost PP test code.

There are quite a few failures in this clang emulation of the VC++
preprocessor when tested against the preprocessor test code. In fact
testing clang emulation of VC++ preprocessor when I don't treat clang as
VC++ in Boost PP, but as its normal C++ standard conforming
preprocessor, still fails a few cases but far less than when clang is
treated as VC++ in Boost PP. Needless to say when invoking clang-linux,
which tests the normal clang implementation whether on Windows or Linux,
there are no failures in the Boost PP tests.

I am perfectly willing to push my changes to 'develop' for the
preprocessor. The changes are essentially just in the Boost PP
config.hpp file, which sets macros which control the compiler
workarounds in Boost PP. As I have previously stated I am not personally
willing to try to figure out or report to clang why their VC++
preprocessor emulation in Boost PP is failing, but others who are
interested can do so if they wish. My personal reasons for this is that
I think it is a very bad thing to attempt to replicate an already flawed
C++ preprocessor in another compiler in general code. I also have spent
enough time working with the VC++ preprocessor trying to find
workarounds for its non-standard behavior that I do not want to do so
for another preprocessor which attempts to be non-standard.

I posted this to alert others to my plans to update Boost PP on
'develop' with this change, in case anybody is greatly opposed to it or
wants to discuss it further. The change will not affect any other
compiler but clang in VC++ preprocessor emulation mode. Unless I hear
objections etc. I plan to push my update within the next day although I
will wait awhile for any replies to this post.

Boost list run by bdawes at, gregod at, cpdaniel at, john at