Boost logo

Boost-Build :

Subject: Re: [Boost-build] [requires] cxx11_variadic_macros
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2015-10-14 15:02:45


Le 14/10/15 07:12, Jürgen Hunold a écrit :
> Hi Raffi,
>
> Am Dienstag, 13. Oktober 2015, 19:45:05 schrieb Edward Diener:
>> On 10/13/2015 11:41 AM, Raffi Enficiaud wrote:
>>> Hi all,
>>>
>>> I have the following requirement on my bjam:
>>>
>>> requirements_boost_test = [ requires cxx11_variadic_macros ] ;
>
> On which Jamfile? Can you either attach a small testcase or point us to the
> feature branch containing the original Jamfile?

It's in the branch topic/dataset-API-improvement, the
test/build/Jamfile.v2 . I was just playing around with this, and so far
I do not know how to check for variadic macro support. I was relying on
this:

#if !BOOST_PP_VARIADICS || ((__cplusplus >= 201103L) &&
defined(BOOST_NO_CXX11_VARIADIC_MACROS))

   #define BOOST_TEST_NO_VARIADIC
#endif

which relies on what BOOST_PP_VARIADICS says for C++03. I do want this
check only for the tests though, but also extend the range of BOOST_TEST
support if I can safely enforce BOOST_PP_VARIADICS=1.

>>> When I compile it on clang/OSX, in C++03 mode, I have this:
>>>
>>> ../../../b2
>>>
>>> - Boost.Config Feature Check: cxx11_variadic_macros : yes
>>> - Boost.Config Feature Check: cxx11_decltype : no
>>> - Boost.Config Feature Check: cxx11_hdr_random : yes
>>> - Boost.Config Feature Check: cxx11_hdr_tuple : no
>>> - Boost.Config Feature Check: cxx11_hdr_initializer_list : no
>
> So either clang enables c++11 variadic macros in c++03 mode (which I doubt) or
> your test detects C99 variadic macros, too..

Compiling a simple example using variadic macros using C++03 dialect
works (for this compiler). So the "cxx11_variadic_macros : yes" is kind
of correct, even if we are not in the C++11 dialect (?).

>
>>> When I compile it on clang6/OSX, in C++11 mode, I have this
>>>
>>> ../../../b2 cxxflags="-stdlib=libc++ -std=c++11"
>>> linkflags="-stdlib=libc++"
>>>
>>> - Boost.Config Feature Check: cxx11_variadic_macros : yes
>>> - Boost.Config Feature Check: cxx11_decltype : yes
>>> - Boost.Config Feature Check: cxx11_hdr_random : yes
>>> - Boost.Config Feature Check: cxx11_hdr_tuple : yes
>>> - Boost.Config Feature Check: cxx11_hdr_initializer_list : yes
>>>
>>> The cxx11_variadic_macros is active for both configuration, but the
>>> variadic macros are not available with the "b2" toolset configuration.
>>
>> What exactly do you mean when you say 'the
>> variadic macros are not available with the "b2" toolset configuration' ?
>
> C++11 variadic macros should not be enabled with "-std=c++03". The question is
> if the detection report "true" if only C99 variadic macros are available.

That is the funny thing. Should this say no to any cxx11_XXXX feature
compiled in C++03?

>
>> Variadic macro support in Boost PP ( and Boost VMD ), and libraries
>> which use Boost PP, is not determined by Boost config. Instead it is
>> determined internally based on the compiler and/or level of c++11
>> support. In general compiling with c++11 support will turn on variadic
>> macro support in Boost PP for most compilers, but both VC++ 8 on up and
>> clang have variadic macro support turned on automatically in Boost PP.
>> You can also force variadic macro support in Boost PP by defining
>> BOOST_PP_VARIADICS to 1.
>>
>> Of course if you are not talking about variadic macros in Boost PP the
>> preceding paragraph does not help you.
>
> No, I guess it is about variadic macros in Boost.Test and selective activating
> the test for them only if c++11 is enabled.
>
>>> When it says cxx11_variadic_macros, I believe it does not try to compile
>>> with C++11 mode.
>>>
>>> How would I detect properly the support for variadic macros?
>
> You are on the correct path. It is hard to say more without looking at or
> trying you test cases. And I have to figure out how to get b2 to spit out the
> generated command lines for the configuration tests...
>
> Yours,
>
> Jürgen
>


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk