I have a debugging setup where you set various debug flags in the makefile, and then in each source file we have:
#ifdef DEBUG_FLAG
# define DEBUGGING(...) Something(__VA_ARGS__)
#else
# define DEBUGGING(...) do {} while(0)
#endif
I would like to make this be more concise by having the source file say something like:
#define DEBUGGING(...) DEBUG_HELP( DEBUG_FLAG, Something(__VA_ARGS__) )
where DEBUG_HELP is defined in a header, with the same end result, i.e. using the DEBUGGING macro will cause Something to be called, only if DEBUG_FLAG was defined as non-zero. If DEBUG_FLAG was not defined at all then the code should still compile, just not call Something.
Is this possible at all?
My attempts so far, I have not been able to figure out a way to not get a compilation error in the case where DEBUG_FLAG was not defined at all.
DEBUG_HELPis defined? Can it be wrapped in#ifdef DEBUG_FLAGcondition?#if DEBUG_FLAG #define DEBUGGING(...) Something(__VA_ARGS__) #endif?