hi! I have these two different macros; one is a scaled down version of the other. I have a header where I need to choose which macro to use for every module in my firmware (~100 modules), at compile time. Here is an example of what I'm trying to do, but I know this macro doesn't work because I can't have multiple directives on the same line...
where __MODULE__ is a -D flag in the makefile for which module is being compiled...
I must do this in a header so I can easily go back and change levels as needed, and everything is in one spot. Do anyone know how to modify this so it will work? thank you
Code:
enum DEBUG_LEVEL{ none, medium, high }
#define DBG(module, debug_level) \
#if (__MODULE__) == (module) \
#if (MODULEMATCH==1) \
#error "already matched!" \
#endif \
\
#define debug DEBUGS(debug_level) \ // this will just choose which debug macro for that module to expand inline
#define MODULEMATCH=1; \
#endif
DBG(moduleA, 0);
DBG(moduleB, 1);
where __MODULE__ is a -D flag in the makefile for which module is being compiled...
I must do this in a header so I can easily go back and change levels as needed, and everything is in one spot. Do anyone know how to modify this so it will work? thank you
Comment