# HG changeset patch # User "Balazs Dezso " # Date 1222073761 -7200 # Node ID 7abfb55f1ecc813ea33ff03ec3f5e909d1e738b2 # Parent b4784a66a8e6c7069d9a0af4250d0055e435be75 Removing fixme an log assert handler from assertion system diff -r b4784a66a8e6 -r 7abfb55f1ecc lemon/assert.h --- a/lemon/assert.h Mon Sep 22 08:37:23 2008 +0100 +++ b/lemon/assert.h Mon Sep 22 10:56:01 2008 +0200 @@ -27,8 +27,9 @@ namespace lemon { - inline void assert_fail_log(const char *file, int line, const char *function, - const char *message, const char *assertion) + inline void assert_fail_abort(const char *file, int line, + const char *function, const char* message, + const char *assertion) { std::cerr << file << ":" << line << ": "; if (function) @@ -37,13 +38,6 @@ if (assertion) std::cerr << " (assertion '" << assertion << "' failed)"; std::cerr << std::endl; - } - - inline void assert_fail_abort(const char *file, int line, - const char *function, const char* message, - const char *assertion) - { - assert_fail_log(file, line, function, message, assertion); std::abort(); } @@ -63,17 +57,14 @@ #endif // LEMON_ASSERT_H #undef LEMON_ASSERT -#undef LEMON_FIXME #undef LEMON_DEBUG -#if (defined(LEMON_ASSERT_LOG) ? 1 : 0) + \ - (defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \ +#if (defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \ (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) > 1 #error "LEMON assertion system is not set properly" #endif -#if ((defined(LEMON_ASSERT_LOG) ? 1 : 0) + \ - (defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \ +#if ((defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \ (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 || \ defined(LEMON_ENABLE_ASSERTS)) && \ (defined(LEMON_DISABLE_ASSERTS) || \ @@ -82,10 +73,7 @@ #endif -#if defined LEMON_ASSERT_LOG -# undef LEMON_ASSERT_HANDLER -# define LEMON_ASSERT_HANDLER ::lemon::assert_fail_log -#elif defined LEMON_ASSERT_ABORT +#if defined LEMON_ASSERT_ABORT # undef LEMON_ASSERT_HANDLER # define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort #elif defined LEMON_ASSERT_CUSTOM @@ -120,12 +108,12 @@ /// /// \brief Macro for assertion with customizable message /// -/// Macro for assertion with customizable message. \param exp An -/// expression that must be convertible to \c bool. If it is \c -/// false, then an assertion is raised. The concrete behaviour depends -/// on the settings of the assertion system. \param msg A const -/// char* parameter, which can be used to provide information -/// about the circumstances of the failed assertion. +/// Macro for assertion with customizable message. +/// \param exp An expression that must be convertible to \c bool. If it is \c +/// false, then an assertion is raised. The concrete behaviour depends on the +/// settings of the assertion system. +/// \param msg A const char* parameter, which can be used to provide +/// information about the circumstances of the failed assertion. /// /// The assertions are enabled in the default behaviour. /// You can disable them with the following code: @@ -139,17 +127,12 @@ /// \endcode /// The checking is also disabled when the standard macro \c NDEBUG is defined. /// -/// The LEMON assertion system has a wide range of customization -/// properties. As a default behaviour the failed assertion prints a -/// short log message to the standard error and aborts the execution. +/// As a default behaviour the failed assertion prints a short log message to +/// the standard error and aborts the execution. /// -/// The following modes can be used in the assertion system: -/// -/// - \c LEMON_ASSERT_LOG The failed assertion prints a short log -/// message to the standard error and continues the execution. -/// - \c LEMON_ASSERT_ABORT This mode is similar to the \c -/// LEMON_ASSERT_LOG, but it aborts the program. It is the default -/// behaviour. +/// However, the following modes can be used in the assertion system: +/// - \c LEMON_ASSERT_ABORT The failed assertion prints a short log message to +/// the standard error and aborts the program. It is the default behaviour. /// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler /// function. /// \code @@ -177,22 +160,6 @@ /// \ingroup exceptions /// -/// \brief Macro for mark not yet implemented features. -/// -/// Macro for mark not yet implemented features and outstanding bugs. -/// It is close to be the shortcut of the following code: -/// \code -/// LEMON_ASSERT(false, msg); -/// \endcode -/// -/// \see LEMON_ASSERT -# define LEMON_FIXME(msg) \ - (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME, \ - ::lemon::_assert_bits::cstringify(msg), \ - static_cast(0))) - -/// \ingroup exceptions -/// /// \brief Macro for internal assertions /// /// Macro for internal assertions, it is used in the library to check @@ -224,7 +191,6 @@ # ifndef LEMON_ASSERT_HANDLER # define LEMON_ASSERT(exp, msg) (static_cast(0)) -# define LEMON_FIXME(msg) (static_cast(0)) # define LEMON_DEBUG(exp, msg) (static_cast(0)) # else # define LEMON_ASSERT(exp, msg) \ @@ -233,11 +199,6 @@ LEMON_FUNCTION_NAME, \ ::lemon::_assert_bits::cstringify(msg), \ #exp), 0))) -# define LEMON_FIXME(msg) \ - (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME, \ - ::lemon::_assert_bits::cstringify(msg), \ - static_cast(0))) - # if LEMON_ENABLE_DEBUG # define LEMON_DEBUG(exp, msg) \ (static_cast (!!(exp) ? 0 : ( \ diff -r b4784a66a8e6 -r 7abfb55f1ecc test/error_test.cc --- a/test/error_test.cc Mon Sep 22 08:37:23 2008 +0100 +++ b/test/error_test.cc Mon Sep 22 10:56:01 2008 +0200 @@ -47,14 +47,9 @@ LEMON_ASSERT(false, "This is a fault message"); } -void fixme_disable() { - LEMON_FIXME("fixme_disable() is fixme!"); -} - void check_assertion_disable() { no_assertion_text_disable(); assertion_text_disable(); - fixme_disable(); } #undef LEMON_DISABLE_ASSERTS @@ -78,15 +73,10 @@ LEMON_ASSERT(false, "This is a fault message"); } -void fixme_custom() { - LEMON_FIXME("fixme_custom() is fixme!"); -} - void check_assertion_custom() { no_assertion_text_custom(); assertion_text_custom(); - fixme_custom(); - check(cnt == 2, "The custom assert handler does not work"); + check(cnt == 1, "The custom assert handler does not work"); } #undef LEMON_ASSERT_CUSTOM