comparison common/debug.h @ 230:92b1e5ed2d5f

Cleanup and documentation in debugging macros.
author Sascha Wilde <wilde@intevation.de>
date Fri, 28 Mar 2014 10:32:55 +0100
parents 19de529ce7fb
children
comparison
equal deleted inserted replaced
229:e99e39d72af2 230:92b1e5ed2d5f
1 #ifndef DEBUG_H 1 #ifndef DEBUG_H
2 #define DEBUG_H 2 #define DEBUG_H
3 3
4 /** 4 /**
5 * @file debug.h 5 * @file
6 * @brief Helper macros for debugging 6 * @brief Helper macros for debugging
7 */ 7 */
8 8
9 /** 9 /**
10 * @def DEBUGOUTPUT
11 * @brief If defined code for extra debugging output will be generated.
12 *
13 * Will be defined if current build is not an RELEASE_BUILD.
14 */
15 #ifndef RELEASE_BUILD
16 #define DEBUGOUTPUT
17 #endif
18
19 /**
20 * @def DEBUGPREFIX
21 * @brief A string prepended to debug output.
22 *
23 * Should be defined to indicate which module created the output.
24 */
25 #ifndef DEBUGPREFIX
26 #define DEBUGPREFIX ""
27 #endif
28
29 /**
30 * @def DEBUGPRINTF(fmt, ...)
10 * @brief Debug printf 31 * @brief Debug printf
11 * 32 *
12 * Prints to stderr if RELEASE_BUILD is not defined. 33 * Prints to stderr if DEBUGOUTPUT is defined.
13 */ 34 */
14 #ifndef RELEASE_BUILD 35 #ifdef DEBUGOUTPUT
15 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); 36 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
16 #else 37 #else
17 #define DEBUGPRINTF(fmt, ...) 38 #define DEBUGPRINTF(fmt, ...)
18 #endif 39 #endif
19 40

http://wald.intevation.org/projects/trustbridge/