lemon/assert.h
changeset 216 6d7bfcf5b48e
parent 209 765619b7cbb2
child 212 1ae84dea7d09
equal deleted inserted replaced
4:3f1f13ef82cd 5:36a25a448990
   149 ///   LEMON_ASSERT_LOG, but it aborts the program. It is the default
   149 ///   LEMON_ASSERT_LOG, but it aborts the program. It is the default
   150 ///   behaviour.
   150 ///   behaviour.
   151 /// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler
   151 /// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler
   152 ///   function.
   152 ///   function.
   153 ///   \code
   153 ///   \code
   154 ///     void custom_assert_handler(const char* file, int line, const char* function,
   154 ///     void custom_assert_handler(const char* file, int line,
   155 ///                                const char* message, const char* assertion);
   155 ///                                const char* function, const char* message,
       
   156 ///                                const char* assertion);
   156 ///   \endcode
   157 ///   \endcode
   157 ///   The name of the function should be defined as the \c
   158 ///   The name of the function should be defined as the \c
   158 ///   LEMON_CUSTOM_ASSERT_HANDLER macro name.
   159 ///   LEMON_CUSTOM_ASSERT_HANDLER macro name.
   159 ///   \code
   160 ///   \code
   160 ///     #define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler
   161 ///     #define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler
   183 /// \endcode
   184 /// \endcode
   184 ///
   185 ///
   185 /// \see LEMON_ASSERT
   186 /// \see LEMON_ASSERT
   186 #  define LEMON_FIXME(msg)                                                \
   187 #  define LEMON_FIXME(msg)                                                \
   187   (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,        \
   188   (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,        \
   188                         ::lemon::_assert_bits::cstringify(msg),                \
   189                         ::lemon::_assert_bits::cstringify(msg),          \
   189                         static_cast<const char*>(0)))
   190                         static_cast<const char*>(0)))
   190 
   191 
   191 /// \ingroup exceptions
   192 /// \ingroup exceptions
   192 ///
   193 ///
   193 /// \brief Macro for internal assertions
   194 /// \brief Macro for internal assertions
   238 #    if LEMON_ENABLE_DEBUG
   239 #    if LEMON_ENABLE_DEBUG
   239 #      define LEMON_DEBUG(exp, msg)
   240 #      define LEMON_DEBUG(exp, msg)
   240          (static_cast<void> (!!(exp) ? 0 : (         \
   241          (static_cast<void> (!!(exp) ? 0 : (         \
   241            LEMON_ASSERT_HANDLER(__FILE__, __LINE__,  \
   242            LEMON_ASSERT_HANDLER(__FILE__, __LINE__,  \
   242                                 LEMON_FUNCTION_NAME, \
   243                                 LEMON_FUNCTION_NAME, \
   243                                 ::lemon::_assert_bits::cstringify(msg),        \
   244                                 ::lemon::_assert_bits::cstringify(msg),     \
   244                                 #exp), 0)))
   245                                 #exp), 0)))
   245 #    else
   246 #    else
   246 #      define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
   247 #      define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
   247 #    endif
   248 #    endif
   248 #  endif
   249 #  endif