Boost logo

Boost :

Subject: [boost] [preprocessor] vc++ using the experimental preprocessor
From: Edward Diener (eldiener_at_[hidden])
Date: 2018-10-21 04:44:15


I have updated on the 'develop' branch Boost PP code that will use the
vc++ C++ standard conforming preprocessor in VS2017 15.8 and above, as
explained at
https://blogs.msdn.microsoft.com/vcblog/2018/07/06/msvc-preprocessor-progress-towards-conformance/.
The code essentially treats vc++ in this mode as a strictly standard
conforming preprocessor. There is the switch of
/experimental:preprocessor which turns on the new preprocessor for the
end-user, else the normal non-standard vc++ preprocessor is still the
current default. BTW I tried to post a comment to the link above,
explaining that the test posted in the article for the new preprocessor
was wrong, but for whatever reason it never was actually posted as a
comment. Nonetheless I got it right for myself in the Boost PP code in
its config.hpp, so I am not going to worry about the fact that others
may use the erroneous test in the article in their code.

The change I made to Boost PP does not affect any other compiler,
including vc++ in normal non-standard preprocessor mode.

I have no idea if any regression tests for msvc-14.1 are made with this
/experimental:preprocessor switch, but I will wait for 'develop' to
cycle through before merging to 'master' in Boost PP.

My preprocessor tests show four failures with the new vc++ preprocessor.
Two of the failures are based on the fact that the test code expects a
macro called with the wrong number of arguments to produce a compiler
error and not just a warning. But since I have been told, vis-a-vis the
same situation occurring for the Oracle C ++ compiler, that compilers
are allowed under the C++ standard to produce a warning and just "chug"
on, even if producing macro output that is certainly not what the
programmer intended, rather than produce a compilation error maybe I
just need to eliminate those tests, as important as I think they are.
The other two failures are with the BOOST_PP_ITERATE macro and
corresponding structures. The new preprocessor also erroneously
continues to give a number of argument mismatch warnings in cases where
it does not really exist, similar to the non-standard preprocessor, but
since it "chugs" on despite the false warnings it ends up producing the
correct output anyway.

I have already posted a bug report about the fact that the new
preprocessor gives a warning and continues when a macro is called with
the wrong number of arguments. The other problem with BOOST_PP_ITERATE
will be harder to determine because the iterate mechanism in Boost PP is
fairly complex and I will need to figure out what is causing it and
reduce the failure to a much simpler form in order to report it. As far
as the compiler warnings of the wrong number of arguments when they do
not exist, again I will have to try and figure out why and report the
bug(s) to Microsoft.

If anyone wants to try this out on Boost PP 'develop' feel free to do
so. You will need to invoke the msvc-14.1 toolset in Boost Build with
the /experimental:preprocessor switch and you will need to upgrade
VS2017 to 15.8 or above. You can tell whether you have succeeded
invoking the Boost PP tests with the new preprocessor by looking at the
run output of the config_info test. If the BOOST_PP_CONFIG_FLAGS() is
0x0001 it is the new preprocessor, else it is the default non-standard
preprocessor (0x0004).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk