"Vegard Nossum" <[EMAIL PROTECTED]> wrote: | It should be possible to optimize out multi-line (block) entries | based on log-level filtering even though the log-level is only given | in the first call (the initializer). It may take the shape of an | if-block that spans several macros. This is not very elegant or robust | if the macros are used incorrectly, however. Aborting a message can | also be hard this way (since the abort would usually appear inside an | if-statement that tests for some abnormal condition, thus appear in a | different block, and thoroughly mess up the bracket order). | | Example: { | #define kprint_block_init(block, loglevel) \ | if(loglevel > CONFIG_KPRINT_LOGLEVEL_MAX) { \ | kprint_real_block_init(block, loglevel); | | #define kprint_block(block, fmt, ...) \ | kprint_real_block(block, fmt, ## __VA_ARGS__); | | #define kprint_block_flush(block) \ | kprint_real_block_flush(block); \ | }
As you point out yourself, this is not very elegant or robust. In fact, it is very dangerous. Why not simply pass the loglevel to each macro? -- Dick Streefland //// Altium BV [EMAIL PROTECTED] (@ @) http://www.altium.com --------------------------------oOO--(_)--OOo--------------------------- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/