From: Edward Diener (eldiener_at_[hidden])
Date: 2019-11-14 20:34:21
I have added to the 'develop' branch of Boost PP an 'explicit' test with
the alias of 'test_iso' in the 'test' subdirectory. This test, depending
on the compiler toolset and C++ standard setting used, will test a
compiler's ability to expand correctly the macros listed in a C++
standard document's "Macro Replacement" section for C++ standards 2003,
2001, 2014, 2017, and 2020 ( N4835 ).
The test uses the __cplusplus setting and the Boost PP
BOOST_PP_VARIADICS setting to determine which C++ standard's set of
macros to test. This is because the __cplusplus setting alone is
misleading for a number of compilers, most notably vc++ and compilers
who mimic vc++, who do not set the correct __cplusplus setting for the
C++ standard level being used.
There are really only three sets of macros from the C++ standard
documents which can potentially be tested, despite five different
standards being considered. This is because the set of macros to be
tested for C++11, C++14, and C++17 are exactly the same.
Some compilers do allow C++20 support but do not implement the full
__VA_OPT__ support yet, so these compilers will fail the C++20 macro
tests with compiler errors. Among these are gcc and vc++, who both
document that they do not yet support the stringizing operator with the
__VA_OPT__ parameter. Clang also supports C++20 and will run the test
and succeed in that mode. You can of course test any compiler at any C++
level and view the results.
These tests, unlike Boost PP, do not have any workarounds for any
compilers. So the tests form a really good basis for reporting macro
expansion preprocessor bugs to various compiler implementations.
In the 'test' subdirectory of Boost PP you should be able to run:
b2 toolset=atoolset cxxstd=astandard( optional ) test_iso
to get the results for any compiler.
Any failed results will show the test output, where the original
expression, the expanded expression, and for individual failed tests the
expected expanded expression will be shown. The actual macros being used
are in the appropriate C++ Standard documents or can be seen in the test
program which is called cpp_standard.cpp in the same 'test' subdirectory.
After the upcoming release I will push this to the 'master' branch.
Please note that the test is an 'explicit' test so it is not normally
run when you just run the tests for Boost PP.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk