Compile error with gcc

Garrett Cooper yanegomi at
Mon Feb 17 06:08:00 UTC 2014

On Feb 16, 2014, at 5:13 AM, Julio Merino <jmmv at> wrote:

> On Feb 16, 2014, at 8:05, Dimitry Andric <dim at> wrote:
>> On 16 Feb 2014, at 13:45, Julio Merino <jmmv at> wrote:
>>> On Feb 16, 2014, at 7:11, Dimitry Andric <dim at> wrote:
>>>> I don't think this will always work correctly.  If MK_LIBCPLUSPLUS is
>>>> defined in, it only means libc++ is being *built*, not that
>>>> it is being used.
>>>> It is probably easier and more fool-proof to check if _LIBCPP_VERSION is
>>>> defined (which is the case when you use libc++) in bconfig.h, like so:
>>>> Index: contrib/atf/bconfig.h
>>>> ===================================================================
>>>> --- contrib/atf/bconfig.h       (revision 261974)
>>>> +++ contrib/atf/bconfig.h       (working copy)
>>>> @@ -56,7 +56,9 @@
>>>> #define HAVE_UNSETENV 1
>>>> /* Define to 1 if vsnprintf is in std */
>>>> +#ifdef _LIBCPP_VERSION
>>>> #define HAVE_VSNPRINTF_IN_STD 1
>>>> +#endif
>>> Let's not do that unless we can change to generate these same contents.
>>> Maybe we can just revert this to _not_ define HAVE_VSNPRINTF_IN_STD as it used to be the case before the new import?  Things were working just fine with both libstdc++ and libc++ even if that setting was not accurate for the latter...
>> Well, contrib/atf/atf-c++/detail/application.cpp has:
>> #if !defined(HAVE_VSNPRINTF_IN_STD)
>> namespace std {
>> using ::vsnprintf;
>> }
>> #endif // !defined(HAVE_VSNPRINTF_IN_STD)
>> so it sort of hacks around it anyway. :-)
> Right, so what does C++ say about this?  Is that snippet OK even when std::vsnprintf is already defined, as is the case for libc++?  (I.e. won't that using directive ever conflict with the library?)
> If the above is true, then I'd just kill the whole HAVE_VSNPRINTF_IN_STD stupidity from both bconfig.h and application.cpp!

Thanks Dimitry for the input.

Should this check be done with…

#if defined(__cplusplus) && __cplusplus >= <some-date>

etc, and if so, what c++ standard was vsnprintf incorporated into? It looks like <some-date> should be 201103L (c++11) ( ). If so, then the tests should instead set the appropriate -std variable (or setting), then test for c++’s existence. Similarly, libc++ might need to be fixed to scope out -std properly, unless it’s purely a c++11 and newer library.


More information about the freebsd-testing mailing list