Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-11-16 18:25:44


w.r.t boost in HEAD and GCC 4.2.1:

      boost/details/utf8_codecvt_facet.hpp specifies do_length as
      do_length(const mbstate_t&, const char*, const char*, size_t) const

the first const comes from the expansion of the macro BOOST_CODECVT_DO_LENGTH_CONST,
which is defined in the same file as:

      #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
          #define BOOST_CODECVT_DO_LENGTH_CONST const
      #else
          #define BOOST_CODECVT_DO_LENGTH_CONST
      #endif

But in GCC 4.2.1 do_length is defined in /usr/include/c++/4.2.1/bits/codecvt.h without
the const specifier. This causes a warning.
When boost is installed in system include directories this warning is typically masked
(unless you use -Wsystem-headers).
But people having boost in their own directory (say as a fallback strategy when boost
is not found on the system) would see the warning. And if the use -Werror their compilations
would stop.

I don't know what the standard prescribes for do_length, but at least from the time being
GCC should be added to the list of exceptions when defining BOOST_CODECVT_DO_LENGTH_CONST
(or if most libraries define the non-const version have that as default and make exceptions
for toolchain that have the const specifier.

I haven't checked how boost tests are set up, but if they are only run on libraries installed
in system directories it might be useful to add tests for when boost is installed locally.
This would catch problems like the above.

Thanks for the great job on boost and hope this fix can be added to the new release.
Best regards,

     Maurizio

 


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