Boost logo

Boost :

Subject: [boost] BOOST_NO_CXX11_HDR_CODECVT confusion
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-11-17 13:51:43


I use BOOST_NO_CXX11_HDR_CODECVT from config.hpp in order to selectively
enable code which uses the built-in codecvt facets as opposed to the
boost "home brew" one we've been using for a long time. I do similar
things with other macros such as BOOST_NO_CXX11_HDR_FORWARD_LIST.

Problems arise when I use a recent compiler such as gcc 6.2 with the
switch -std=c++03 as in

"/hpc-6.2/usr/local/bin/g++" -ftemplate-depth-128 -std=c++03 -O0
-fno-inline -Wall -g -dynamic -gdwarf-2 -fexceptions -fPIC -arch x86_64
-Wno-unused-variable -Wno-long-long -ftemplate-depth-255
-DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_DYN_LINK=1
-DBOOST_LIB_DIAGNOSTIC=1 -DBOOST_SERIALIZATION_DYN_LINK=1
-DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_WSERIALIZATION_DYN_LINK=1
-I"../../.." -c -o
"../../../bin.v2/libs/serialization/test/test_iterators.test/darwin-6.2~03/debug/test_iterators.o"
"test_iterators.cpp"

In this ease I would expect to find that BOOST_NO_CXX11_HDR_CODECVT is
defined as C++ standard does not include <codecvt> headers for versions
prior to C++ 11. But the test matrix
http://www.boost.org/development/tests/develop/developer/output/Sandia-gcc-6-2-0-boost-bin-v2-libs-config-test-config_info-test-gcc-6-2-0-debug.html
for this compilers shows that BOOST_NO_CXX11_HDR_CODECVT is NOT defined
when no -std=c++03 is used.

OK - I see that for gcc 6.2 the default is C++ 14 if no switch is used.
So the test matrix is OK. I'm not sure what the column is meant to test
as it does specify a particular version as the other columns do. So I
think the test for gcc 6.2 - and all the g++/clang compiler would be
improved by specifying which version of the C++ standard they are
actually testing.

But I still have a problem. When I use the swithc -std=c++03 I expect
that BOOST_NO_CXX11_HDR_CODECVT be defined as C++ versions prior to C++
11 don't have header <codecvt>. Same goes for other headers required
only for more recent compilers. But my expectations aren't realized as
BOOST_NO_CXX11_HDR_CODECVT is not defined in this case. The leads to
selection of library code which invokes an #error saying that it's not
supported.

Perhaps definition of BOOST_NO_CXX11_HDR_CODECVT is conditioned solely
on the existence of <codecvt> rather than the existence of <codecvt> and
the compiler running in C++ 11+ "mode". I think this is what is messing
things up for me.

I might be able to work around this if I config.hpp included a macro
which indicated which standard version it's intended to support. It
doesn't have this. But I wouldn't need it if the BOOST_NO... worked as
I would expect.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk