Compare commits

...

43 Commits

Author SHA1 Message Date
d135cad759 Merge branch 'develop' 2018-10-25 19:41:15 -04:00
8d26689387 Merge branch 'develop' of https://github.com/boostorg/preprocessor into develop 2018-10-25 16:58:28 -04:00
f78f0a1d25 Removing any forcing of C++ levels. 2018-10-25 16:57:55 -04:00
87fd89a7db Merge pull request #20 from Mike-Devel/min_cmake
[CMake] Generate cmake target that other libraries can use
2018-10-23 09:49:20 -04:00
adf2746626 Add support for vc++ /experimental:preprocessor mode. 2018-10-20 14:02:20 -04:00
fe70754559 Include wchar.h in order to test wide character stringize under C. 2018-10-19 16:57:17 -04:00
45588469f3 Only test wide character stringize in c++. 2018-10-19 16:41:43 -04:00
344ce6abf9 [CMake/CI] Use config_info.cpp for cmake self test 2018-10-17 12:13:45 +02:00
31653b34c9 [CMake/CI] Some cleanup 2018-10-17 12:12:57 +02:00
a4e304ca87 [CMake/CI] Add cmake self test to appveyor 2018-10-17 11:33:21 +02:00
0e335df79e Test for stringize macro and use of variadic in stringize macro. 2018-10-16 16:37:10 -04:00
ee5ed2510d [CMake] Add self-test for cmake file to travis 2018-10-16 19:58:45 +02:00
dd44e1eea5 [CMake] Add minimal cmake file
Generate cmake target that can be used by other libraries
to express their dependency on this library and retrieve
any configuration information such as the include directory.
2018-10-09 14:52:17 +02:00
b5c081bf7a Variadic macro support for the PGI compiler when EDG is being used with it. 2018-09-23 09:12:59 -04:00
347f48afae Back out previous CUDA change to turn on variadic macro support for all situations when compiling a CUDA file. 2018-09-10 17:42:32 -04:00
49a72ac4f2 Corrected sentence by removing extra "the". 2018-08-23 19:20:04 -04:00
56090c56b5 Merge branch 'develop' 2018-02-20 09:13:57 -05:00
00b2f44624 Allow the IBM compiler to default to the level of C++/C compliance to determine default variadic macro support 2018-02-18 09:47:44 -05:00
a329a67b47 NVidia compiler supports variadic macros. 2018-02-14 22:01:04 -05:00
34af3a925c Merge pull request #11 from danieljames/feature/fix-links
Fix some links
2018-01-11 13:02:34 -05:00
ad22f9686e Fix some links 2018-01-11 14:20:16 +00:00
39175c471f Merge branch 'develop' 2017-10-30 11:32:10 -04:00
aa9ee3ae3f Removed --depth 1 2017-10-29 21:31:25 -04:00
50ffeeee8b Merge branch 'develop' 2017-10-27 22:31:37 -04:00
f54e270433 Better appveyor designation for tests. 2017-10-09 11:58:08 -04:00
08ec2abb2e Updated appveyor file for correct toolsets. 2017-10-09 11:39:03 -04:00
c4b1ce10bd Add VS2017 worker image. 2017-10-09 11:23:30 -04:00
1ecc2e2ec9 Added Appveyor file. 2017-10-09 08:09:05 -04:00
b19e4deacb Merge branch 'develop' 2017-04-24 12:13:09 -04:00
dfc1c46ece With _MSC_VER and __clang__ always use strict mode and variadics turned on without any VC++ fixes. 2017-03-26 08:51:41 -07:00
e474eea44f Slight correction to particularize previous change as involving only -fno-ms-compatibility mode. 2017-03-26 01:02:05 -07:00
b03c6cd3c0 In the configuration the combination of clang defined and gcc defined always gets strict mode and variadic macro support, even under Windows where VC++ may also be defined. 2017-03-25 23:22:32 -07:00
a6275942f3 Merge branch 'develop' 2017-02-19 03:21:26 -05:00
d8389ffda6 Exclude tests for gcc when C++0x is not supported. This should fix some test matrices for old versions of gcc. 2017-01-05 09:57:01 -05:00
075a3a02c8 Merge branch 'develop' 2017-01-04 11:29:41 -05:00
dc41624aba Added Travis CI file. Updated config.hpp for Intel 17 on Windows. 2016-11-16 13:01:51 -05:00
4ae346bbc5 Merge pull request #9 from sergiud/intel-17.0-fix
Intel C++ compiler 17.0 fix
2016-11-16 09:40:21 -05:00
d922d757be Fix for VC++ and VC++ emuolations ot the SEQ_TO_LIST macro 2016-11-16 00:15:57 -05:00
eb143c10f8 Added configuration info test. 2016-11-14 00:25:46 -05:00
e1e3a2e21e added Intel C++ compiler 17.0 workaround 2016-11-11 15:30:21 +01:00
e70abe7b49 Updated for VC++ quirks and overload code example. 2016-04-11 14:24:38 -04:00
ee73989a21 Further change to ensure that clang targeting VC++ behaves as the VC++ preprocessor 2016-03-30 13:52:02 -04:00
7835ed019c Updated configuration to support clang targeting VC++ 2016-03-30 12:08:46 -04:00
21 changed files with 497 additions and 89 deletions

48
.travis.yml Normal file
View File

@ -0,0 +1,48 @@
# Copyright 2016 Edward Diener
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
python: "2.7"
os:
- linux
- osx
branches:
only:
- master
- develop
matrix:
include:
- install: true
script:
- mkdir __build__ && cd __build__
- cmake ../test
- cmake --build .
install:
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- cp -r $TRAVIS_BUILD_DIR/* libs/preprocessor
- python tools/boostdep/depinst/depinst.py preprocessor
- ./bootstrap.sh
- ./b2 headers
script:
- TOOLSET=gcc,clang
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
- ./b2 libs/preprocessor/test toolset=$TOOLSET
notifications:
email:
on_success: always

12
CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
# Copyright 2018 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5)
project(BoostPreprocessor LANGUAGES CXX)
add_library(boost_preprocessor INTERFACE)
add_library(Boost::preprocessor ALIAS boost_preprocessor)
target_include_directories(boost_preprocessor INTERFACE include)

60
appveyor.yml Normal file
View File

@ -0,0 +1,60 @@
# Copyright 2017 Edward Diener
# Copyright 2018 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
configuration:
- boost_test
- cmake_self_test
branches:
only:
- master
- develop
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0,msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
build: off
for:
-
matrix:
only:
- configuration: cmake_self_test
test_script:
- mkdir __build__
- cd __build__
- cmake ../test
- cmake --build .
-
matrix:
only:
- configuration: boost_test
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\preprocessor
- python tools/boostdep/depinst/depinst.py preprocessor
- bootstrap
- b2 headers
test_script:
- b2 libs/preprocessor/test toolset=%TOOLSET%
- cd ../preprocessor/test

View File

@ -22,7 +22,7 @@
<div>
This macro is useful when a delay is necessary to produce the correct semantics of a macro invocation.&nbsp;
For example, when a macro expands to an argument list to another macro.&nbsp;
This macro will expand the the argument list on the first pass, and then rescan to expand any more macros.
This macro will expand the argument list on the first pass, and then rescan to expand any more macros.
</div>
<h4>Requirements</h4>
<div>

View File

@ -33,7 +33,7 @@
</ul>
<h4>Requirements</h4>
<div>
<b>Header:</b> &nbsp;<a href="../headers/facilities/identity_n.html">&lt;boost/preprocessor/facilities/identity.hpp&gt;</a>
<b>Header:</b> &nbsp;<a href="../headers/facilities/identity.html">&lt;boost/preprocessor/facilities/identity.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div><pre>

View File

@ -42,7 +42,7 @@ not occur.<br>
<b>Header:</b> &nbsp;<a href="../headers/tuple/eat.html">&lt;boost/preprocessor/tuple/eat.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div><pre>#include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;<br>#include &lt;<a href="../headers/tuple/eat.html">boost/preprocessor/tuple/eat.hpp</a>&gt;<br><br>#define OP(a, b) (a b)<br><br>#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, OP, <a href="tuple_eat.html">BOOST_PP_TUPLE_EAT</a>(2))(1, 2)<br><br>// or for the variadic version <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br><br>#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, OP, <a href="file:///C:/Programming/VersionControl/sandbox/variadics/libs/preprocessor/doc/ref/tuple_eat.html">BOOST_PP_TUPLE_EAT</a>())(1, 2)<br><br>MACRO(0) // expands to nothing<br>MACRO(1) // expands to (1, 2)<br></pre></div>
<div><pre>#include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;<br>#include &lt;<a href="../headers/tuple/eat.html">boost/preprocessor/tuple/eat.hpp</a>&gt;<br><br>#define OP(a, b) (a b)<br><br>#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, OP, <a href="tuple_eat.html">BOOST_PP_TUPLE_EAT</a>(2))(1, 2)<br><br>// or for the variadic version <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br><br>#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, OP, <a href="tuple_eat.html">BOOST_PP_TUPLE_EAT</a>())(1, 2)<br><br>MACRO(0) // expands to nothing<br>MACRO(1) // expands to (1, 2)<br></pre></div>
<hr size="1">
<div style="margin-left: 0px;">
<i><EFBFBD> Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>

View File

@ -49,7 +49,7 @@ or<br>
<b>Header:</b> &nbsp;<a href="../headers/tuple/elem.html">&lt;boost/preprocessor/tuple/elem.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div><pre>#include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;<br><br>#define TUPLE (a, b, c, d)<br><br><a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(4, 0, TUPLE) // expands to a<br><a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(4, 3, TUPLE) // expands to d<br><br>// or for the variadic version <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br><br><a href="file:///C:/Programming/VersionControl/sandbox/variadics/libs/preprocessor/doc/ref/tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(0, TUPLE) // expands to a in the variadic version<br><a href="file:///C:/Programming/VersionControl/sandbox/variadics/libs/preprocessor/doc/ref/tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, TUPLE) // expands to d in the variadic version<br></pre></div>
<div><pre>#include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;<br><br>#define TUPLE (a, b, c, d)<br><br><a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(4, 0, TUPLE) // expands to a<br><a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(4, 3, TUPLE) // expands to d<br><br>// or for the variadic version <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br><br><a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(0, TUPLE) // expands to a in the variadic version<br><a href="file:///C:/Programming/VersionControl/sandbox/variadics/libs/preprocessor/doc/ref/tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, TUPLE) // expands to d in the variadic version<br></pre></div>
<hr size="1">
<div style="margin-left: 0px;">
<i><EFBFBD> Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>

View File

@ -12,12 +12,12 @@
<ul>
<li><a href="add_d.html"><span style="color: gray;">BOOST_PP_ADD_D</span></a></li>
<li><a href="div_d.html"><span style=" color: gray;">BOOST_PP_DIV_D</span></a></li>
<li><a href="file:///C:/Programming/VersionControl/modular-boost/libs/preprocessor/doc/ref/div_d.html"><span
<li><a href="div_d.html"><span
style=" color: gray;"></span></a><a href="mod_d.html"><span style=" color: gray;">BOOST_PP_MOD_D</span></a></li>
<li><a href="file:///C:/Programming/VersionControl/modular-boost/libs/preprocessor/doc/ref/mod_d.html"><span
<li><a href="mod_d.html"><span
style=" color: gray;"></span></a><a href="mul_d.html"><span
style=" color: gray;">BOOST_PP_MUL_D</span></a></li>
<li><a href="file:///C:/Programming/VersionControl/modular-boost/libs/preprocessor/doc/ref/mul_d.html"><span
<li><a href="mul_d.html"><span
style=" color: gray;"></span></a><a href="sub_d.html"><span
style=" color: gray;">BOOST_PP_SUB_D</span></a></li>
</ul>

View File

@ -25,7 +25,7 @@
# define BOOST_PP_CAT_OO(par) BOOST_PP_CAT_I ## par
# endif
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# if (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
# define BOOST_PP_CAT_I(a, b) a ## b
# else
# define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(~, a ## b)

View File

@ -25,18 +25,20 @@
# define BOOST_PP_CONFIG_DMC() 0x0040
#
# ifndef BOOST_PP_CONFIG_FLAGS
# if defined(__GCCXML__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__WAVE__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200
# if defined(__GCCXML__) || defined(__WAVE__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__EDG__) || defined(__EDG_VERSION__)
# if defined(_MSC_VER) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# if defined(_MSC_VER) && !defined(__clang__) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# if !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# endif
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT())
# endif
# elif defined(_MSC_VER) && defined(__clang__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__MWERKS__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MWCC())
# elif defined(__DMC__)
@ -45,8 +47,12 @@
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_BCC())
# elif defined(_MSC_VER) && !defined(__clang__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# elif defined(_MSC_VER)
# if !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# endif
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# endif
@ -73,13 +79,18 @@
# define BOOST_PP_VARIADICS_MSVC 0
# if !defined BOOST_PP_VARIADICS
# /* variadic support explicitly disabled for all untested compilers */
# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI
# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || (defined(__PGI) && !defined(__EDG__))
# define BOOST_PP_VARIADICS 0
# /* VC++ (C/C++) */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__
# elif defined(_MSC_VER) && defined(__clang__)
# define BOOST_PP_VARIADICS 1
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
# /* VC++ (C/C++) and Intel C++ Compiler >= 17.0 with MSVC */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__) || defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
# define BOOST_PP_VARIADICS 1
# if !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
# endif
# /* Wave (C/C++), GCC (C++) */
# elif defined __WAVE__ && __WAVE_HAS_VARIADICS__ || defined __GNUC__ && defined __GXX_EXPERIMENTAL_CXX0X__ && __GXX_EXPERIMENTAL_CXX0X__
# define BOOST_PP_VARIADICS 1
@ -92,7 +103,7 @@
# elif !BOOST_PP_VARIADICS + 1 < 2
# undef BOOST_PP_VARIADICS
# define BOOST_PP_VARIADICS 1
# if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL)
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
# endif

View File

@ -30,14 +30,13 @@
# endif
# if BOOST_PP_VARIADICS
# if BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \
BOOST_PP_VARIADIC_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,__VA_ARGS__) \
/**/
# define BOOST_PP_SEQ_BINARY_TRANSFORM_REM(data) data
# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B
# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A
# else
# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) BOOST_PP_REM
# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B
# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A
# endif
# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B
# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A
# else
# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_B
# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_A

View File

@ -0,0 +1,55 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2016. *
# * Distributed under the Boost Software License, Version 1.0. (See *
# * accompanying file LICENSE_1_0.txt or copy at *
# * http://www.boost.org/LICENSE_1_0.txt) *
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
# define BOOST_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
#
# include <boost/preprocessor/config/config.hpp>
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
#
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/control/while.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# define BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state) \
BOOST_PP_TUPLE_ELEM(2, 0, state) \
/**/
# define BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
BOOST_PP_TUPLE_ELEM(2, 1, state) \
/**/
# define BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED(d,state) \
BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
/**/
# define BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_OP(d,state) \
( \
BOOST_PP_CAT(BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state),), \
BOOST_PP_DEC(BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state)) \
) \
/**/
#
# /* BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC */
#
# define BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC(result,seqsize) \
BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT \
( \
BOOST_PP_WHILE \
( \
BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED, \
BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC_OP, \
(result,seqsize) \
) \
) \
/**/
# endif // BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
#
# endif // BOOST_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP

View File

@ -19,7 +19,19 @@
#
# /* BOOST_PP_SEQ_TO_LIST */
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# include <boost/preprocessor/seq/size.hpp>
# include <boost/preprocessor/seq/detail/to_list_msvc.hpp>
# define BOOST_PP_SEQ_TO_LIST(seq) \
BOOST_PP_SEQ_DETAIL_TO_LIST_MSVC \
( \
BOOST_PP_SEQ_TO_LIST_I(BOOST_PP_SEQ_BINARY_TRANSFORM(seq)), \
BOOST_PP_SEQ_SIZE(seq) \
) \
/**/
# else
# define BOOST_PP_SEQ_TO_LIST(seq) BOOST_PP_SEQ_TO_LIST_I(BOOST_PP_SEQ_BINARY_TRANSFORM(seq))
# endif
# define BOOST_PP_SEQ_TO_LIST_I(bseq) BOOST_PP_SEQ_TO_LIST_A bseq BOOST_PP_NIL BOOST_PP_SEQ_TO_LIST_B bseq
# define BOOST_PP_SEQ_TO_LIST_A(m, e) m(BOOST_PP_LPAREN() e BOOST_PP_COMMA() BOOST_PP_SEQ_TO_LIST_A_ID)
# define BOOST_PP_SEQ_TO_LIST_A_ID() BOOST_PP_SEQ_TO_LIST_A

View File

@ -28,6 +28,10 @@
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
# endif
#
#if BOOST_PP_VARIADICS
# define BOOST_PP_STRINGIZE_I(...) #__VA_ARGS__
#else
# define BOOST_PP_STRINGIZE_I(text) #text
#endif
#
# endif

View File

@ -23,7 +23,11 @@
# define BOOST_PP_WSTRINGIZE_OO(par) BOOST_PP_WSTRINGIZE_I ## par
# endif
#
#if BOOST_PP_VARIADICS
# define BOOST_PP_WSTRINGIZE_I(...) BOOST_PP_WSTRINGIZE_II(#__VA_ARGS__)
#else
# define BOOST_PP_WSTRINGIZE_I(text) BOOST_PP_WSTRINGIZE_II(#text)
#endif
# define BOOST_PP_WSTRINGIZE_II(str) L ## str
#
# endif

16
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
# Copyright 2018 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#
# NOTE: This does NOT run the unit tests for Boost.Preprocessor (yet).
# It only tests, if the CMakeLists.txt file works as expected
cmake_minimum_required( VERSION 3.5 )
project( BoostPreprocessorCMakeSelfTest )
add_subdirectory( .. ${CMAKE_CURRENT_BINARY_DIR}/boost_preprocessor )
add_executable( boost_preprocessor_cmake_self_test config_info.cpp )
target_link_libraries( boost_preprocessor_cmake_self_test Boost::preprocessor )

View File

@ -17,27 +17,43 @@ project preprocessor_tests : requirements <warnings>on
<toolset>msvc:<warnings>all
;
test-suite preprocessor
alias preprocessor : :
<toolset>gcc
<toolset-gcc:version>3.4
;
alias preprocessor : :
<toolset>gcc
<toolset-gcc:version>4.1
;
alias preprocessor : :
<toolset>gcc
<toolset-gcc:version>4.2
;
alias preprocessor
:
[ compile arithmetic.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile array.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile comparison.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile control.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile debug.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile facilities.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile iteration.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile list.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile logical.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile punctuation.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile repetition.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile selection.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile seq.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile slot.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile tuple.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile variadic.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile arithmetic.cpp ]
[ compile array.cpp ]
[ compile comparison.cpp ]
[ compile control.cpp ]
[ compile debug.cpp ]
[ compile facilities.cpp ]
[ compile iteration.cpp ]
[ compile list.cpp ]
[ compile logical.cpp ]
[ compile punctuation.cpp ]
[ compile repetition.cpp ]
[ compile selection.cpp ]
[ compile seq.cpp ]
[ compile slot.cpp ]
[ compile stringize.cpp ]
[ compile tuple.cpp ]
[ compile variadic.cpp ]
;
test-suite preprocessor_nvm
alias preprocessor_nvm
:
[ compile arithmetic.cpp : <define>BOOST_PP_VARIADICS=0 : arithmetic_nvm ]
[ compile array.cpp : <define>BOOST_PP_VARIADICS=0 : array_nvm ]
@ -52,166 +68,182 @@ test-suite preprocessor_nvm
[ compile selection.cpp : <define>BOOST_PP_VARIADICS=0 : selection_nvm ]
[ compile seq.cpp : <define>BOOST_PP_VARIADICS=0 : seq_nvm ]
[ compile slot.cpp : <define>BOOST_PP_VARIADICS=0 : slot_nvm ]
[ compile stringize.cpp : <define>BOOST_PP_VARIADICS=0 : stringize_nvm ]
[ compile tuple.cpp : <define>BOOST_PP_VARIADICS=0 : tuple_nvm ]
;
test-suite preprocessor_c
alias preprocessor_c
:
[ compile arithmetic.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: arithmetic_c
]
[ compile array.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: array_c
]
[ compile comparison.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: comparison_c
]
[ compile control.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: control_c
]
[ compile debug.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: debug_c
]
[ compile facilities.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: facilities_c
]
[ compile list.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: list_c
]
[ compile logical.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: logical_c
]
[ compile punctuation.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: punctuation_c
]
[ compile selection.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: selection_c
]
[ compile seq.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: seq_c
]
[ compile slot.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: slot_c
]
[ compile stringize.c
:
: stringize_c
]
[ compile tuple.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: tuple_c
]
[ compile variadic.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: variadic_c
]
;
test-suite preprocessor_c_nvm
alias preprocessor_c_nvm
:
[ compile arithmetic.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <define>BOOST_PP_VARIADICS=0
: arithmetic_c_nvm
]
[ compile array.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <define>BOOST_PP_VARIADICS=0
: array_c_nvm
]
[ compile comparison.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: comparison_c_nvm
]
[ compile control.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: control_c_nvm
]
[ compile debug.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: debug_c_nvm
]
[ compile facilities.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: facilities_c_nvm
]
[ compile list.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: list_c_nvm
]
[ compile logical.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: logical_c_nvm
]
[ compile selection.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: selection_c_nvm
]
[ compile seq.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: seq_c_nvm
]
[ compile slot.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: slot_c_nvm
]
[ compile stringize.c
: <define>BOOST_PP_VARIADICS=0
: stringize_c_nvm
]
[ compile tuple.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: tuple_c_nvm
]
;
test-suite preprocessor_isempty
alias preprocessor_isempty : :
<toolset>gcc
<toolset-gcc:version>3.4
;
alias preprocessor_isempty : :
<toolset>gcc
<toolset-gcc:version>4.1
;
alias preprocessor_isempty : :
<toolset>gcc
<toolset-gcc:version>4.2
;
alias preprocessor_isempty
:
[ compile isempty.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile-fail isempty_variadic_standard_failure.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile-fail isempty_variadic_standard_failure2.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang:<cxxflags>-std=c++0x ]
[ compile isempty.cpp ]
[ compile-fail isempty_variadic_standard_failure.cpp : <define>BOOST_PP_VARIADICS=1 ]
[ compile-fail isempty_variadic_standard_failure2.cpp : <define>BOOST_PP_VARIADICS=1 ]
;
test-suite preprocessor_isempty_nvm
alias preprocessor_isempty_nvm
:
[ compile isempty.cpp : <define>BOOST_PP_VARIADICS=0 : isempty_nvm ]
[ compile isempty.cpp : <define>BOOST_PP_VARIADICS=0 : isempty_nvm ]
;
test-suite preprocessor_isempty_c
alias preprocessor_isempty_c
:
[ compile isempty.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
:
: isempty_c
]
[ compile-fail isempty_variadic_standard_failure.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <define>BOOST_PP_VARIADICS=1
: isempty_variadic_standard_failure_c
]
[ compile-fail isempty_variadic_standard_failure2.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <define>BOOST_PP_VARIADICS=1
: isempty_variadic_standard_failure2_c
]
;
test-suite preprocessor_isempty_c_nvm
alias preprocessor_isempty_c_nvm
:
[ compile isempty.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: isempty_c_nvm
]
;
alias preprocessor_config
:
[ run config_info.cpp ]
;

93
test/config_info.cpp Normal file
View File

@ -0,0 +1,93 @@
#include <iostream>
#include <iomanip>
#include <string.h>
#include <boost/preprocessor/stringize.hpp>
static unsigned int indent = 4;
static unsigned int width = 40;
using std::cout;
using std::istream;
void print_separator()
{
std::cout <<
"\n\n*********************************************************************\n\n";
}
void print_macro(const char* name, const char* value)
{
// if name == value+1 then then macro is not defined,
// in which case we don't print anything:
if(0 != strcmp(name, value+1))
{
for(unsigned i = 0; i < indent; ++i) std::cout.put(' ');
std::cout << std::setw(width);
cout.setf(istream::left, istream::adjustfield);
std::cout << name;
if(value[1])
{
// macro has a value:
std::cout << value << "\n";
}
else
{
// macro is defined but has no value:
std::cout << " [no value]\n";
}
}
}
#define PRINT_MACRO(X) print_macro(#X, BOOST_PP_STRINGIZE(=X))
void print_macros()
{
print_separator();
PRINT_MACRO(__GCCXML__);
PRINT_MACRO(__WAVE__);
PRINT_MACRO(__MWERKS__);
PRINT_MACRO(__EDG__);
PRINT_MACRO(_MSC_VER);
PRINT_MACRO(__clang__);
PRINT_MACRO(__DMC__);
PRINT_MACRO(__BORLANDC__);
PRINT_MACRO(__IBMC__);
PRINT_MACRO(__IBMCPP__);
PRINT_MACRO(__SUNPRO_CC);
PRINT_MACRO(__CUDACC__);
PRINT_MACRO(__PATHSCALE__);
PRINT_MACRO(__CODEGEARC__);
PRINT_MACRO(__HP_aCC);
PRINT_MACRO(__SC__);
PRINT_MACRO(__MRC__);
PRINT_MACRO(__PGI);
PRINT_MACRO(__INTEL_COMPILER);
PRINT_MACRO(__GNUC__);
PRINT_MACRO(__GXX_EXPERIMENTAL_CXX0X__);
print_separator();
PRINT_MACRO(__cplusplus);
PRINT_MACRO(__STDC_VERSION__);
PRINT_MACRO(__EDG_VERSION__);
PRINT_MACRO(__INTELLISENSE__);
PRINT_MACRO(__WAVE_HAS_VARIADICS__);
print_separator();
PRINT_MACRO(BOOST_PP_CONFIG_ERRORS);
PRINT_MACRO(BOOST_PP_CONFIG_EXTENDED_LINE_INFO);
PRINT_MACRO(BOOST_PP_CONFIG_FLAGS());
PRINT_MACRO(BOOST_PP_VARIADICS);
PRINT_MACRO(BOOST_PP_VARIADICS_MSVC);
}
int main()
{
print_macros();
return 0;
}

12
test/stringize.c Normal file
View File

@ -0,0 +1,12 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2018.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/stringize.cxx>

12
test/stringize.cpp Normal file
View File

@ -0,0 +1,12 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2018.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/stringize.cxx>

38
test/stringize.cxx Normal file
View File

@ -0,0 +1,38 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2018.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <boost/preprocessor/stringize.hpp>
# include <boost/preprocessor/wstringize.hpp>
# include <boost/preprocessor/arithmetic/inc.hpp>
# if !defined __cplusplus
#include <wchar.h>
#endif
# include <libs/preprocessor/test/test.h>
#define VDATA 1,2,3,4
#define NDATA
#define DATA data
#define FDATA(x) BOOST_PP_INC(x)
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
BEGIN sizeof(BOOST_PP_STRINGIZE(NDATA)) / sizeof(char) == 1 END
BEGIN sizeof(BOOST_PP_WSTRINGIZE(NDATA)) / sizeof(wchar_t) == 1 END
#endif
BEGIN sizeof(BOOST_PP_STRINGIZE(DATA)) / sizeof(char) == 5 END
BEGIN sizeof(BOOST_PP_STRINGIZE(FDATA(1))) / sizeof(char) == 2 END
BEGIN sizeof(BOOST_PP_STRINGIZE(FDATA(9))) / sizeof(char) == 3 END
BEGIN sizeof(BOOST_PP_WSTRINGIZE(DATA)) / sizeof(wchar_t) == 5 END
BEGIN sizeof(BOOST_PP_WSTRINGIZE(FDATA(1))) / sizeof(wchar_t) == 2 END
BEGIN sizeof(BOOST_PP_WSTRINGIZE(FDATA(9))) / sizeof(wchar_t) == 3 END
#if BOOST_PP_VARIADICS
BEGIN sizeof(BOOST_PP_STRINGIZE(VDATA)) / sizeof(char) == 8 END
BEGIN sizeof(BOOST_PP_WSTRINGIZE(VDATA)) / sizeof(wchar_t) == 8 END
#endif