Compare commits

...

31 Commits

Author SHA1 Message Date
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
c2beb74b90 Updated for VC++ quirks and overload code example. 2016-04-14 08:52:06 -04: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
3292532517 Merge branch 'master' into develop 2015-10-16 18:47:02 -04:00
b1be22cf77 Merge pull request #8 from mgaunard/patch-1
lower version requirement for SunCC and variadics
2015-10-08 11:34:04 -04:00
f59d83b8bf lower version requirement for SunCC and variadics
Macro variadics appear to work fine with SunCC 5.12.
2015-10-08 11:31:27 +01:00
15 changed files with 454 additions and 165 deletions

39
.travis.yml Normal file
View File

@ -0,0 +1,39 @@
# 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
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

36
appveyor.yml Normal file
View File

@ -0,0 +1,36 @@
# Copyright 2017 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)
version: 1.0.{build}-{branch}
shallow_clone: true
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
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
build: off
test_script:
- b2 libs/preprocessor/test toolset=%TOOLSET%

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

@ -1,46 +1,58 @@
<html>
<head>
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
<title>BOOST_PP_OVERLOAD</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;"> The <b>BOOST_PP_OVERLOAD</b> variadic macro expands to the name of a non-variadic macro having a given number of parameters.<br>
</div>
<h4>Usage</h4>
<div class="code"> <b>BOOST_PP_OVERLOAD</b>(<i>prefix</i>,...) <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br>
</div>
<h4>Arguments</h4>
<dl>
<dt>prefix<br>
</dt><dd>
The prefix of the non-variadic macro name.
</dd><dt>...<br>
</dt><dd><i>
Variadic data</i>. The number of variadic data
elements, as determined by BOOST_PP_VARIADIC_SIZE, is appended to the
prefix to form the output non-variadic macro name.<br>
</dd>
</dl>
<h4>Remarks</h4>
<div> This macro creates a macro name which depends on the number of elements of variadic data. It should be used in the form of <br>
BOOST_PP_OVERLOAD(MACRO_NAME_,__VA_ARGS__)(__VA_ARGS__) in order to
call a non-variadic macro taking a given number of variadic data
elements as non-variadic arguments. In this way one can invoke a
variadic macro with a variable number of parameters which calls one of
a series of non-variadic macros doing very similar things.
</div><b>Requirements</b>
<div> <b>Header:</b> &nbsp;<a href="../headers/facilities/overload.html">&lt;boost/preprocessor/facilities/overload.hpp&gt;</a>
<div style="margin-left: 0px;"> The <b>BOOST_PP_OVERLOAD</b> variadic
macro expands to the name of a non-variadic macro having a given number of
parameters.<br>
</div>
<h4>Usage</h4>
<div class="code"> <b>BOOST_PP_OVERLOAD</b>(<i>prefix</i>,...) <a href="../topics/variadic_macros.html#VNotation"
target="_self"><sup>(v)</sup></a><br>
</div>
<h4>Arguments</h4>
<dl>
<dt>prefix<br>
</dt>
<dd> The prefix of the non-variadic macro name. </dd>
<dt>...<br>
</dt>
<dd><i> Variadic data</i>. The number of variadic data
elements, as determined by BOOST_PP_VARIADIC_SIZE, is appended to the
prefix to form the output non-variadic macro name.<br>
</dd>
</dl>
<h4>Remarks</h4>
<div> This macro creates a macro name which depends on the number of
elements of variadic data. It should be used in the form of <br>
BOOST_PP_OVERLOAD(MACRO_NAME_,__VA_ARGS__)(__VA_ARGS__) in order to
call a non-variadic macro taking a given number of variadic data
elements as non-variadic arguments. In this way one can invoke a
variadic macro with a variable number of parameters which calls one of
a series of non-variadic macros doing very similar things.
</div>
<b>Requirements</b>
<div> <b>Header:</b> &nbsp;<a href="../headers/facilities/overload.html">&lt;boost/preprocessor/facilities/overload.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div>
<pre>#include &lt;<a href="../headers/facilities/overload.html">boost/preprocessor/facilities/overload.hpp</a>&gt;<br>#include <<a
href="../headers/cat.html">boost/preprocessor/cat.hpp</a>><br>#include <<a href="../headers/facilities/empty.html">boost/preprocessor/facilities/empty.hpp</a>><br>#include <<a
href="../headers/arithmetic/add.html">boost/preprocessor/arithmetic/add.hpp</a>><br><br>#define MACRO_1(number) MACRO_2(number,10)<br>#define MACRO_2(number1,number2) <a
href="add.html">BOOST_PP_ADD</a>(number1,number2)<br><br>#if !BOOST_PP_VARIADICS_MSVC<br><br>#define MACRO_ADD_NUMBERS(...) <a
href="overload.html">BOOST_PP_OVERLOAD</a>(MACRO_,__VA_ARGS__)(__VA_ARGS__)<br><br>#else<br><br>// or for Visual C++<br><br>#define MACRO_ADD_NUMBERS(...) \<br> <a
href="cat.html">BOOST_PP_CAT</a>(<a href="overload.html">BOOST_PP_OVERLOAD</a>(MACRO_,__VA_ARGS__)(__VA_ARGS__),<a
href="empty.html">BOOST_PP_EMPTY</a>())<br><br>#endif<br><br>MACRO_ADD_NUMBERS(5) // output is 15<br>MACRO_ADD_NUMBERS(3,6) // output is 9</pre>
</div>
<h4>Sample Code</h4>
<div>
<pre>#include &lt;<a href="../headers/facilities/overload.html">boost/preprocessor/facilities/overload.hpp</a>&gt;<br>#include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;<br>#include &lt;<a href="../headers/facilities/empty.html">boost/preprocessor/facilities/empty.hpp</a>&gt;<br>#include &lt;<a href="../headers/arithmetic/add.html">boost/preprocessor/arithmetic/add.hpp</a>&gt;<br><br>#define MACRO_1(number) MACRO_2(number,10)<br>#define MACRO_2(number1,number2) <a href="add.html">BOOST_PP_ADD</a>(number1,number2)<br><br>#define MACRO_ADD_NUMBERS(...) <a href="overload.html">BOOST_PP_OVERLOAD</a>(MACRO_,__VA_ARGS__)(__VA_ARGS__)<br><br>// or for Visual C++<br><br>#define MACRO_ADD_NUMBERS(...) \<br> <a href="cat.html">BOOST_PP_CAT</a>(<a href="overload.html">BOOST_PP_OVERLOAD</a>(MACRO_,__VA_ARGS__)(__VA_ARGS__),<a href="empty.html">BOOST_PP_EMPTY</a>())<br><br>MACRO_ADD_NUMBERS(5) // output is 15<br>MACRO_ADD_NUMBERS(3,6) // output is 9<br></pre>
</div>
<hr size="1">
<div style="margin-left: 0px;"> <i></i><i><EFBFBD> Copyright Edward Diener 2011,2013</i> </div>
<div style="margin-left: 0px;">
<hr size="1">
<div style="margin-left: 0px;"> <i></i><i><EFBFBD> Copyright Edward Diener 2011,2013,2016</i> </div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0.
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>
</body></html>

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

@ -1,40 +1,37 @@
<html>
<head>
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
<title>variadic_macros.html</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
<link rel="stylesheet" type="text/css" href="../styles.css">
<style>
u { font-weight: normal; text-decoration: none; }
</style>
</head>
<body>
<h4>Variadic Macros</h4>
<div> Variadic macros are supported by a number of compilers.
They are
macros of the form:
</div>
<div class="code">
<div> Variadic macros are supported by a number of compilers. They are
macros of the form: </div>
<div class="code">
<pre>#define SOME_MACRO(ZeroOrMoreParameters,...) macro expansion possible specifying __VA_ARGS__</pre>
</div>
<div> The '...' in the parameter list represents the variadic
data when the macro is invoked and the __VA_ARGS__ in the expansion
represents the variadic data in the expansion of the macro. Variadic
data is of the form of 1 or more preprocessor tokens separated by
commas.<br>
<div> The '...' in the parameter list represents the variadic data when the
macro is invoked and the __VA_ARGS__ in the expansion represents the
variadic data in the expansion of the macro. Variadic data is of the form
of 1 or more preprocessor tokens separated by commas.<br>
<br>
The '...' must be the last parameter in the macro definition and there
may be 0 or more non-variadic parameters preceding it.<br>
The '...' must be the last parameter in the macro definition and there may
be 0 or more non-variadic parameters preceding it.<br>
<br>
In the expansion of the macro __VA_ARGS__ may be specified 0 or more
times to represent the variadic data. The variadic data in the
expansion is a comma separated list of preprocessor tokens representing
the variadic data which the invoker of the macro enters as the last
arguments to the macro.<br>
In the expansion of the macro __VA_ARGS__ may be specified 0 or more times
to represent the variadic data. The variadic data in the expansion is a
comma separated list of preprocessor tokens representing the variadic data
which the invoker of the macro enters as the last arguments to the macro.<br>
</div>
<h4>Example<u> - Creating and invoking a variadic macro.</u></h4>
<div class="code">
<div class="code">
<pre>#define INITIALIZE_INT_ARRAY(array_name,...) \ <br> static int array_name[] = { __VA_ARGS__ }; \ <br> /**/<br><br> INITIALIZE_INT_ARRAY(myname,45,789,33510,9346,2)</pre>
</div>
<u> <span style="font-weight: bold;">Preprocessor
<u> <span style="font-weight: bold;">Preprocessor
Library Support<br>
</span></u>
<div>The library offers support for variadic macros for those
@ -56,7 +53,15 @@
When BOOST_PP_VARIADICS is 1, the library offers some extended
functionality
by using variadic macros, and also offers extended support for working
with variadic data.<br>
with variadic data.<br><br>
<a name="vmvcquirk"></a>Visual C++ has a
few quirks related to variadic macros which require the end-user to code
slightly differently. When BOOST_PP_VARIADICS is 1 and Visual C++ is the
compiler BOOST_PP_VARIADICS_MSVC is 1, else when BOOST_PP_VARIADICS is 1
and Visual C++ is not the compiler BOOST_PP_VARIADICS_MSVC is 0. When
BOOST_PP_VARIADICS is 0 then BOOST_PP_VARIADICS_MSVC is not defined.
In this way the end-user, when using variadic macros, can test for the
presence of Visual C++ as the compiler and code accordingly.<br>
<br>
Support for working with variadic
data is largely centered on being able to convert variadic data to
@ -64,7 +69,7 @@
functionality for working with those Boost preprocessor library data
types is much greater than that for working with variadic data directly.<br>
</div>
<a name="VNotation"></a>
<a name="VNotation"></a>
<h4>Notation For Variadic Macros<br>
</h4>
<div>In the documentation, headers which have variadic macros,
@ -131,7 +136,7 @@
use this variadic data reliably as arguments to other macros, one needs
variadic macro support.<br>
</div>
<u style="font-weight: bold;"> Using a Tuple Instead of an Array<br>
<u style="font-weight: bold;"> Using a Tuple Instead of an Array<br>
</u>
<div>An array as a preprocessor data type is a two-element tuple where the
first element is the array size and the second element is a tuple which
@ -144,7 +149,7 @@
type is essentially obsolete for conforming C++ compilers. Only if your
compiler does not support variadic macros is the preprocessor array data
type still useful.</div>
<u style="font-weight: bold;">Using Variadic Data</u>
<u style="font-weight: bold;">Using Variadic Data</u>
<div>Variadic data exists in the
form of comma-separated preprocessor tokens. This is the case whether
the variadic data comes from the __VA_ARGS__ of a variadic macro, from
@ -169,7 +174,7 @@
variadic data as a whole to variadic macros as the last parameter of
the macro. However: <br>
<br>
<span style="font-weight: bold;">Attempting to pass
<span style="font-weight: bold;">Attempting to pass
variadic data as a
whole directly into a non-variadic macro is not guaranteed to work and
may fail.<br>
@ -178,7 +183,7 @@
of compilers, currently most notably Visual C++. Even passing variadic
data as arguments to a non-variadic macro, when it is not represented
in
the form of&nbsp; __VA_ARGS__, may fail with certain compilers.<br>
the form of<EFBFBD> __VA_ARGS__, may fail with certain compilers.<br>
<br>
What follows are very simple examples, showing how variadic data can be
passed to a non-variadic macro.<br>
@ -188,9 +193,9 @@
<h4>Example<u> - Passing variadic data as a whole to a
non-variadic
macro. DO NOT DO.</u></h4>
<div class="code">
<div class="code">
<pre>#define MACRO_ARG_2(x,y) BOOST_PP_ADD(x,y)<br>#define VAR_MACRO(...) __VA_ARGS__<br><br>/* The following should not be done and is not guaranteed to work with compilers. */<br><br><span
style="font-weight: bold;"><span style="font-family: monospace;"></span></span>int xx = MACRO_ARG_2(VAR_MACRO(2,3));</pre>
style="font-weight: bold;"><span style="font-family: monospace;"></span></span>int xx = MACRO_ARG_2(VAR_MACRO(2,3));</pre>
</div>
<div> There are two ways to pass variadic data to a non-variadic
macro.
@ -203,7 +208,7 @@ style="font-weight: bold;"><span style="font-family: monospace;"></span></span>i
a
non-variadic macro.<br>
</u></h4>
<div class="code">
<div class="code">
<pre>#define MACRO_ARG_2(x,y) BOOST_PP_ADD(x,y)<br>#define VAR_MACRO(...) __VA_ARGS__<br><br>/* The following will work correctly */<br><br>int xx = MACRO_ARG_2<br> (<br> BOOST_PP_VARIADIC_ELEM(0,VAR_MACRO(2,3)),<br> BOOST_PP_VARIADIC_ELEM(1,VAR_MACRO(2,3))<br> );</pre>
</div>
<div>The second way is to use a macro in the library called
@ -215,7 +220,7 @@ style="font-weight: bold;"><span style="font-family: monospace;"></span></span>i
BOOST_PP_OVERLOAD
and on to a non-variadic macro.<br>
</u></h4>
<div class="code">
<div class="code">
<pre>#define MACRO_ARG_2(x,y) BOOST_PP_ADD(x,y)<br>#define VAR_MACRO(...) __VA_ARGS__<br><br>/* The following will work correctly */<br><br>int xx = BOOST_PP_OVERLOAD(MACRO_ARG_,VAR_MACRO(2,3))(VAR_MACRO(2,3));<br><br>/* For Visual C++ it is necessary to do this */<br><br>int xx = <br>BOOST_PP_CAT(BOOST_PP_OVERLOAD(MACRO_ARG_,VAR_MACRO(2,3))(VAR_MACRO(2,3)),BOOST_PP_EMPTY());</pre>
</div>
<br>
@ -230,27 +235,28 @@ style="font-weight: bold;"><span style="font-family: monospace;"></span></span>i
</div>
<b>See</b> <b>Also</b><br>
<ul>
<li><a href="../ref/variadics.html">BOOST_PP_VARIADICS</a></li>
<li><a href="../headers/tuple.html">Tuple Macros</a><br>
<li><a href="../ref/variadics.html">BOOST_PP_VARIADICS</a></li>
<li><a href="../headers/tuple.html">Tuple Macros</a><br>
</li>
<li><a href="../headers/variadic.html">Variadic
<li><a href="../headers/variadic.html">Variadic
Macros<br>
</a></li>
<li><a href="../ref/array_enum.html">BOOST_PP_ARRAY_ENUM</a></li>
<li><a href="../ref/list_enum_r.html">BOOST_PP_LIST_ENUM</a></li>
<li><a href="../ref/seq_enum.html">BOOST_PP_SEQ_ENUM</a></li>
<li><a href="../ref/tuple_enum.html">BOOST_PP_TUPLE_ENUM</a></li>
<li><a href="../ref/overload.html">BOOST_PP_OVERLOAD</a></li>
<li><a href="../ref/array_enum.html">BOOST_PP_ARRAY_ENUM</a></li>
<li><a href="../ref/list_enum_r.html">BOOST_PP_LIST_ENUM</a></li>
<li><a href="../ref/seq_enum.html">BOOST_PP_SEQ_ENUM</a></li>
<li><a href="../ref/tuple_enum.html">BOOST_PP_TUPLE_ENUM</a></li>
<li><a href="../ref/overload.html">BOOST_PP_OVERLOAD</a></li>
</ul>
<hr size="1">
<div style="margin-left: 0px;"> <i><EFBFBD> Copyright
<hr size="1">
<div style="margin-left: 0px;"> <i><EFBFBD> Copyright
Edward Diener
2011,2013</i> </div>
<div style="margin-left: 0px;">
2011,2013,2016</i> </div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License,
Version 1.0.
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>
</body></html>

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,16 @@
# 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)
# if defined(_MSC_VER) && !defined(__clang__) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# 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,7 +43,7 @@
# 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__)
# elif defined(_MSC_VER)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
@ -73,10 +71,14 @@
# 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 < 0x5130 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI
# if defined __GCCXML__ || 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
# define BOOST_PP_VARIADICS 0
# /* VC++ (C/C++) */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__
# elif defined(__CUDACC__)
# define BOOST_PP_VARIADICS 1
# elif defined(_MSC_VER) && defined(__clang__)
# define BOOST_PP_VARIADICS 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
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
@ -92,7 +94,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))
# 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

@ -17,27 +17,42 @@ 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 : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile array.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile comparison.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile control.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile debug.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile facilities.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile iteration.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile list.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile logical.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile punctuation.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile repetition.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile selection.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile seq.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile slot.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile tuple.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile variadic.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
;
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 ]
@ -55,163 +70,183 @@ test-suite preprocessor_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
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: arithmetic_c
]
[ compile array.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: array_c
]
[ compile comparison.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: comparison_c
]
[ compile control.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: control_c
]
[ compile debug.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: debug_c
]
[ compile facilities.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: facilities_c
]
[ compile list.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: list_c
]
[ compile logical.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: logical_c
]
[ compile punctuation.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: punctuation_c
]
[ compile selection.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: selection_c
]
[ compile seq.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: seq_c
]
[ compile slot.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: slot_c
]
[ compile tuple.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: tuple_c
]
[ compile variadic.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<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
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: arithmetic_c_nvm
]
[ compile array.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: array_c_nvm
]
[ compile comparison.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: comparison_c_nvm
]
[ compile control.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: control_c_nvm
]
[ compile debug.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: debug_c_nvm
]
[ compile facilities.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: facilities_c_nvm
]
[ compile list.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: list_c_nvm
]
[ compile logical.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: logical_c_nvm
]
[ compile selection.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: selection_c_nvm
]
[ compile seq.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: seq_c_nvm
]
[ compile slot.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: slot_c_nvm
]
[ compile tuple.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<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 : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile-fail isempty_variadic_standard_failure.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
[ compile-fail isempty_variadic_standard_failure2.cpp : <toolset>gcc:<cxxflags>-std=c++0x <toolset>clang-linux:<cxxflags>-std=c++0x ]
;
test-suite preprocessor_isempty_nvm
alias preprocessor_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
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: isempty_c
]
[ compile-fail isempty_variadic_standard_failure.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: isempty_variadic_standard_failure_c
]
[ compile-fail isempty_variadic_standard_failure2.c
: <toolset>gcc:<cflags>-std=c99 <toolset>clang:<cflags>-std=c99
: <toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<cflags>-std=c99
: 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
<toolset>gcc:<cflags>-std=c99 <toolset>clang-linux:<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;
}