Ticket #6451: assert.hpp.patch

File assert.hpp.patch, 2.2 KB (added by Antony Polukhin, 11 years ago)
  • assert.hpp

     
    4242                        char const * function, char const * file, long line); // user defined
    4343} // namespace boost
    4444
     45// BOOST_CURRENT_FUNCTION can produce very long names, that may lead to huge size of output files.
     46// So allow user to define current function macro (for example to shorter __FUNCTION__
     47// macro or to "(unknown)")
     48#ifndef BOOST_ASSERT_CURRENT_FUNCTION_NAME
     49# define BOOST_ASSERT_CURRENT_FUNCTION_NAME BOOST_CURRENT_FUNCTION
     50#endif
     51
    4552#define BOOST_ASSERT(expr) ((expr) \
    4653  ? ((void)0) \
    47   : ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
     54  : ::boost::assertion_failed(#expr, BOOST_ASSERT_CURRENT_FUNCTION_NAME, __FILE__, __LINE__))
    4855
    4956#else
    5057# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
     
    5764
    5865# undef BOOST_ASSERT_MSG
    5966
     67#if !defined(BOOST_DISABLE_ASSERTS) && !defined(NDEBUG)
     68
     69    // BOOST_CURRENT_FUNCTION can produce very long names, that may lead to huge size of output files.
     70    // So allow user to define current function macro (for example to shorter __FUNCTION__
     71    // macro or to "(unknown)")
     72    #ifndef BOOST_ASSERT_MSG_CURRENT_FUNCTION_NAME
     73    # define BOOST_ASSERT_MSG_CURRENT_FUNCTION_NAME BOOST_CURRENT_FUNCTION
     74    #endif
     75
     76#endif
     77
    6078#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG)
    6179
    6280  #define BOOST_ASSERT_MSG(expr, msg) ((void)0)
     
    7391
    7492  #define BOOST_ASSERT_MSG(expr, msg) ((expr) \
    7593    ? ((void)0) \
    76     : ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
     94    : ::boost::assertion_failed_msg(#expr, msg, BOOST_ASSERT_MSG_CURRENT_FUNCTION_NAME, __FILE__, __LINE__))
    7795
    7896#else
    7997  #ifndef BOOST_ASSERT_HPP
     
    116134  #define BOOST_ASSERT_MSG(expr, msg) ((expr) \
    117135    ? ((void)0) \
    118136    : ::boost::assertion::detail::assertion_failed_msg(#expr, msg, \
    119           BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
     137          BOOST_ASSERT_MSG_CURRENT_FUNCTION_NAME, __FILE__, __LINE__))
    120138#endif
    121139
    122140//--------------------------------------------------------------------------------------//