Subject: Re: [boost] Compiler warnings after boost update
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2015-09-22 17:22:06


On 22 September 2015 at 12:52, Auer, Jens wrote:
> Hi,
>
> we compile with high compiler warnings setting (-Wall, -Wpedantic), and treat compiler warnings as errors. Recently, I had to upgrade the boost library version from 1.53 to at least 1.55. Since there was no package available, I compiled it by hand from the source code. With 1.53, everything compiled fine, but with the newer version my builds now break because the boost library generates a lot of warnings, e.g.
> /cots/boost-1.55/include/boost/iterator/iterator_concepts.hpp: At global scope:
> /cots/boost-1.55/include/boost/mpl/assert.hpp:288:54: error: use of old-style cast [-Werror=old-style-cast]
> boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
> ^
> /cots/boost-1.55/include/boost/mpl/assert.hpp:59:58: note: in definition of macro ‘BOOST_MPL_AUX_ASSERT_CONSTANT’
> # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
>
> /cots/boost-1.55/include/boost/range/algorithm/equal.hpp: In function ‘bool boost::range::equal(const SinglePassRange1&, const SinglePassRange2&, BinaryPredicate)’:
> /cots/boost-1.55/include/boost/concept/detail/general.hpp:71:20: error: typedef ‘boost_concept_check185’ locally defined but not used [-Werror=unused-local-typedefs]
> BOOST_PP_CAT(boost_concept_check,__LINE__)
>
> /cots/boost-1.55/include/boost/property_tree/xml_parser.hpp:52:59: required from ‘void boost::property_tree::xml_parser::read_xml(std::basic_istream<typename Ptree::key_type::value_type>&, Ptree&, int) [with Ptree = boost::property_tree::basic_ptree<std::basic_string<char>, std::basic_string<char> >; typename Ptree::key_type::value_type = char; typename Ptree::key_type::value_type = char]’
> /home/auerj/MDAF/src/commons/src/crypto/KeyFileReader.cpp:43:34: required from here
> /cots/boost-1.55/include/boost/property_tree/detail/rapidxml.hpp:1204:33: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
> if (first_attribute())
> ^
> /cots/boost-1.55/include/boost/property_tree/detail/rapidxml.hpp:1204:33: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
> /cots/boost-1.55/include/boost/property_tree/detail/rapidxml.hpp:1211:45: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
>
> These are just some examples, there are literally hundreds of warnings. It is enough to just include ptree.hpp, but other headers have the same issue.
>
> I am wondering why this came up after the update. Is it a configuration problem during the build of the boost libraries, or is it an issue in the boost libraries? I find it hard to believe that the code quality changed so much between the versions.
>
> What is the policy of the boost project concerning compiler warnings in installation headers? I would assume that the libraries should compile without warnings on supported compilers, either because there are no issues, or because warnings are disabled in the boost headers.

If only.

I believe it's up to individual library authors to decide what their
policy is regarding warnings.