Boost logo

Boost :

Subject: [boost] asio config.hpp macro redefinition - mistake?
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2016-01-12 18:32:48


In file boost_1_59_0\boost\asio\detail\config.hpp line 227 gives a macro redefinition warning.

    // Compliant C++11 compilers put noexcept specifiers on error_category members.
    #if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
    # if (BOOST_VERSION >= 105300)
    # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
    # elif defined(__clang__)
    # if __has_feature(__cxx_noexcept__)
    # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
    # endif // __has_feature(__cxx_noexcept__)
    # elif defined(__GNUC__)
    # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
    # if defined(__GXX_EXPERIMENTAL_CXX0X__)
    # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
    # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
    # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
    # endif // defined(__GNUC__)
    # if defined(BOOST_ASIO_MSVC)
    # if (_MSC_VER >= 1900)

    # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
             // ****** here ******

    # endif // (_MSC_VER >= 1900)
    # endif // defined(BOOST_ASIO_MSVC)
    # if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
    # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
    # endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
    #endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)

To paraphrase, the block reads

    # if (BOOST_VERSION >= 105300) // it is: 105900 >= 105300
    *# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT*
    â‹®
    # if defined(BOOST_ASIO_MSVC)
    # if (_MSC_VER >= 1900)
    *# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)*
    # endif // (_MSC_VER >= 1900)
    # endif // defined(BOOST_ASIO_MSVC)

It seems that this is missing a guard or has the if/else things mixed up.


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