j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Fri Apr 4 11:46:21 2014 New Revision: 1285 URL: http://tracker.coreboot.org/trac/openbios/changeset/1285
Log: OFMEM: redefine OFMEM_TRACE macro so that it always compiles
Make sure that we always compile the OFMEM_TRACE macro regardless of whether CONFIG_DEBUG_OFMEM is set, similar to the way in which the DEBUG macros work in QEMU. This relies on the fact that the compiler optimiser will work out that the compile-time "if" test is always true/false and optimise the result out if is it not required.
This ensures that we always get proper debug argument checking and means that certain sections of code don't keep giving unused variable warnings when they only appear in debug codepaths.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/include/libopenbios/ofmem.h
Modified: trunk/openbios-devel/include/libopenbios/ofmem.h ============================================================================== --- trunk/openbios-devel/include/libopenbios/ofmem.h Fri Apr 4 11:46:18 2014 (r1284) +++ trunk/openbios-devel/include/libopenbios/ofmem.h Fri Apr 4 11:46:21 2014 (r1285) @@ -132,9 +132,15 @@ #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
#if defined(CONFIG_DEBUG_OFMEM) -# define OFMEM_TRACE(fmt, ...) do { printk("OFMEM: " fmt, ## __VA_ARGS__); } while (0) + #define DEBUG_OFMEM 1 #else -# define OFMEM_TRACE(fmt, ...) do {} while(0) + #define DEBUG_OFMEM 0 #endif
+#define OFMEM_TRACE(fmt, ...) do { \ + if (DEBUG_OFMEM) { \ + printk("OFMEM: " fmt, ## __VA_ARGS__); \ + } \ +} while (0); + #endif /* _H_OFMEM */