You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-01 00:25:06 +02:00
Add ASSERT_DEBUG() macro for debugging.
Replace all current assert() calls except in tests that can't use the debug code.
This commit is contained in:
29
src/common/debug.h
Normal file
29
src/common/debug.h
Normal file
@ -0,0 +1,29 @@
|
||||
/***********************************************************************************************************************************
|
||||
Debug Routines
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef COMMON_DEBUG_H
|
||||
#define COMMON_DEBUG_H
|
||||
|
||||
#include "common/log.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
NDEBUG indicates to C library routines that debugging is off -- set a more readable flag to use when debugging is on
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef NDEBUG
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Assert Macros
|
||||
***********************************************************************************************************************************/
|
||||
#ifdef DEBUG
|
||||
#define ASSERT_DEBUG(condition) \
|
||||
{ \
|
||||
if (!(condition)) \
|
||||
THROW(AssertError, "assertion '%s' failed", #condition); \
|
||||
}
|
||||
#else
|
||||
#define ASSERT_DEBUG(condition)
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user