Boost logo

Boost-Build :

Subject: Re: [Boost-build] [requires] cxx11_variadic_macros
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-10-14 22:19:07


On 10/14/2015 2:53 PM, Raffi Enficiaud wrote:
> Le 14/10/15 01:45, Edward Diener a écrit :
>> 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 ] ;
>>>
>>> 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
>>>
>>>
>>> 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' ?
>
> Sorry I was unclear. I was meaning that BOOST_PP_VARIADICS is set to 0.
> I erroneously thought that it should be automatically set to 1 if the
> compiler supports variadic macros.
>
> So you're saying that for clang, we should have BOOST_PP_VARIADICS=1.
> Why isn't it the case then? Explicitly setting toolset=clang does not help.
>
> For info:
> > clang --version
> Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
> Target: x86_64-apple-darwin14.5.0
> Thread model: posix

This is my error. Originally clang by default did not have variadic
macro support in Boost PP. Then because of programmer feedback I turned
on variadic macro support by default for clang in Boost PP
unconditionally. This however lead to a slew of clang warnings when
clang was compiled in C/C++ mode less than C99 or C++11. So then I
changed Boost PP so that clang, like gcc, only has variadic macro
support by default when compiling in C99 or C++11 mode. I had forgot
about that final change I made for clang when I responded to this message.

You can force variadic macro support for a compiler in Boost PP by
defining BOOST_PP_VARIADICS=1 before Boost PP headers are included, or
you can make sure of variadic macro support by default for clang and gcc
by compiling in C99 ( for C ) or C++11 ( for C++ ) mode.

>
>
>>
>> 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.
>
> I was talking about variadic macros in general, boost.test is making
> extensive use of boost.pp, and I thought that I would have
> BOOST_PP_VARIADICS=1 as soon as the compiler supports variadic macros.


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