You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-01 00:25:06 +02:00
Split debug and assert code into separate headers.
Assert can be used earlier because it only depends on the error-handler and not logging.
This commit is contained in:
@ -4,8 +4,6 @@ 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
|
||||
***********************************************************************************************************************************/
|
||||
@ -13,28 +11,6 @@ NDEBUG indicates to C library routines that debugging is off -- set a more reada
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Assert Macros
|
||||
***********************************************************************************************************************************/
|
||||
// For very important asserts that are shipped with the production code.
|
||||
#define ASSERT(condition) \
|
||||
{ \
|
||||
if (!(condition)) \
|
||||
THROW(AssertError, "assertion '%s' failed", #condition); \
|
||||
}
|
||||
|
||||
// Used for assertions that should only be run when debugging. Ideal for conditions that are not likely to happen in production but
|
||||
// could occur during development.
|
||||
#ifdef DEBUG
|
||||
#define ASSERT_DEBUG(condition) \
|
||||
{ \
|
||||
if (!(condition)) \
|
||||
THROW(AssertError, "debug assertion '%s' failed", #condition); \
|
||||
}
|
||||
#else
|
||||
#define ASSERT_DEBUG(condition)
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Extern variables that are needed for unit testing
|
||||
***********************************************************************************************************************************/
|
||||
|
Reference in New Issue
Block a user