wilde@172: #ifndef DEBUG_H wilde@172: #define DEBUG_H wilde@172: wilde@172: /** wilde@230: * @file wilde@172: * @brief Helper macros for debugging wilde@172: */ wilde@172: wilde@172: /** wilde@230: * @def DEBUGOUTPUT wilde@230: * @brief If defined code for extra debugging output will be generated. wilde@230: * wilde@230: * Will be defined if current build is not an RELEASE_BUILD. wilde@230: */ wilde@230: #ifndef RELEASE_BUILD wilde@230: #define DEBUGOUTPUT wilde@230: #endif wilde@230: wilde@230: /** wilde@230: * @def DEBUGPREFIX wilde@230: * @brief A string prepended to debug output. wilde@230: * wilde@230: * Should be defined to indicate which module created the output. wilde@230: */ wilde@230: #ifndef DEBUGPREFIX wilde@230: #define DEBUGPREFIX "" wilde@230: #endif wilde@230: wilde@230: /** wilde@230: * @def DEBUGPRINTF(fmt, ...) wilde@172: * @brief Debug printf wilde@172: * wilde@230: * Prints to stderr if DEBUGOUTPUT is defined. wilde@172: */ wilde@230: #ifdef DEBUGOUTPUT wilde@228: #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); wilde@172: #else wilde@227: #define DEBUGPRINTF(fmt, ...) wilde@172: #endif wilde@172: wilde@172: #endif