Opened 8 years ago

Last modified 8 years ago

#10354 reopened Bugs

inconsistent declaration of do_length in boost/detail/utf8_codecvt_facet.hpp due to missing BOOST_WORKAROUND

Reported by: Juan Alday <alday.boost.trac@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

First, the output when trying to build boost in AIX using xlC

xlC_r -c -DBOOST_ALL_NO_LIB=1 -DNDEBUG -qcpluscmt -O3 -qstrict -q64 -qfuncsect -qeh -qrtti -I"." -o "bin.v2/libs/filesystem/build/vacpp-11/release/... utf8_codecvt_facet.o" "libs/filesystem/src/utf8_codecvt_facet.cpp"

"./boost/detail/utf8_codecvt_facet.ipp", line 173.5: 1540-0400 (S) "boost::archive::detail::utf8_codecvt_facet::do_length(const std::mbstate_t &, const char *, const char *, std::size_t) const" has a conflicting declaration. "./boost/detail/utf8_codecvt_facet.hpp", line 174.17: 1540-0424 (I) "do_length" is declared on line 174 of "./boost/detail/utf8_codecvt_facet.hpp".

The problem is that there is a mismatch in the declaration of the function between

  • boost/detail/utf8_codecvt_facet.hpp
  • boost/detail/utf8_codecvt_facet.ipp
    // boost/detail/utf8_codecvt_facet.hpp 
    virtual int do_length(
        const std::mbstate_t &,
        const char * from,
        const char * from_end,
        std::size_t max_limit
    ) const
    // boost/detail/utf8_codecvt_facet.ipp 
    int utf8_codecvt_facet::do_length(
        BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
        const char * from,
        const char * from_end,
        std::size_t max_limit
    ) const
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
        throw()
#endif

The solution is to add BOOST_CODECVT_DO_LENGTH_CONST and the BOOST_WORKAROUND macro in boost/detail/utf8_codecvt_facet.hpp

Also, unless BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, BOOST_WORKAROUND will always evaluate to 1 for any version of xlC, adding a throw() declaration.

Maybe it should be replaced with

#if BOOST_WORKAROUND(__IBMCPP__, <=600)

Last, I've filed this in filesystem component following what was done for https://svn.boost.org/trac/boost/ticket/7660 since there is no specific entry for boost/detail in the component list. It fits as well in serialization, program_options, etc.

Change History (2)

comment:1 by Beman Dawes, 8 years ago

Resolution: fixed
Status: newclosed

Fixed. Thanks!

Here is the commit message:

Fix #10354 from Juan Alday. As he pointed out, the declaration (in detail/utf8_codecvt_facet.hpp) and definition (in detail/utf8_codecvt_facet.ipp) need to use the same signature.

Reapply Marshall Clow's [SVN r81616] and [SVN r81877] from November and December, 2012, as these appear to correctly supply const for the msvc/dinkumware library (since fixed) that used a do_length() first argument.

Revert the portion of [SVN r86722] that removed BOOST_CODECVT_DO_LENGTH_CONST from the do_length() signature in utf8_codecvt_facet.ipp so that it stays in sync with utf8_codecvt_facet.hpp. For the same reason, copy the IBMCPP workaround from utf8_codecvt_facet.ipp to utf8_codecvt_facet.hpp.

Verified all libraries (filesystem, log, program_options, property_tree, serialization) that use utf8_codecvt_facet passed all tests before, and then after, these changes.

Also applied minor edits to the use comments embedded in utf8_codecvt_facet.hpp.

--Beman

comment:2 by Robert Ramey, 8 years ago

Resolution: fixed
Status: closedreopened

After the original changes the test_array_warchive test in the serialization library test suite began to fail for all gcc compilers.

After much time spent investigating this, I concluded that there were collisions in the the codecvt in the standard library and the boost one and I created [SVN r86722] to fix it.

Now that's in backed out, this test is again failing. See http://www.boost.org/development/tests/develop/developer/serialization.html

On possible confusion is that the gcc compilers have an optional switch to select C++03 or C++11. It's not clear which testers use which switch.

So I don't think we're done yet. Good luck with this.

Robert Ramey

Note: See TracTickets for help on using tickets.