FeatStd Diagnostics

Debug Macros

The following macros can get overridden for custom needs:

  • FEATSTD_DEBUG_BREAK
  • FEATSTD_DEBUG_ASSERT
  • FEATSTD_DEBUG_FAIL
  • FEATSTD_DEBUG_REENTRANCE_GUARD

If these macros are not defined in custom header file the default implementation is taken, e.g. (code as in FeatStd/Diagnostics/Debug.h)

#if !defined(FEATSTD_DEBUG_ASSERT)              // <-- allows to override in custom header file
    #if defined(FEATSTD_DEBUG)

        FEATSTD_LINT_MACRO_WHILEFALSE(FEATSTD_DEBUG_ASSERT)
        #define FEATSTD_DEBUG_ASSERT(condition) \
                do { \
                    if (!(condition)) { \
                        if (FeatStd::Diagnostics::DebugControl::Assert((#condition), \
                                                                      __FILE__, __LINE__)) { \
                            FEATSTD_OS_BREAK(); \
                                       } \
                                } \
                            FEATSTD_SUPPRESS_MSC_WARNING_FOR_NEXT_EXPRESSION(4127, while (false) accepted) \
                        } while (false)
    #else
        #define FEATSTD_DEBUG_ASSERT(condition)
    #endif
#endif

Revision #3
Created 2023-03-02 07:54:54 UTC by Kanai Tomoaki
Updated 2023-06-19 04:51:39 UTC by Tsuyoshi.Kato