Re: Buggy vararg macros

Andreas Schwab (schwab@suse.de)
26 Jul 1999 10:51:11 +0200


Andreas Bombe <andreas.bombe@munich.netsurf.de> writes:

|> GCC (more specifically its preprocessor) allows us to use vararg macros
|> and there are a number of those used in the kernel sources. They work,
|> but they rely on current behaviour of gcc because of missing
|> whitespace.
|>
|> Example of how it should be done:
|> #define MY_PRINTK(fmt, args...) printk(KERN_INFO fmt , ## args)
|>
|> Currently the '##' discards the characters up to a preceding macro
|> argument, but it might change to a more clean behaviour of deleting the
|> whole token preceding it. This would include the macro argument if
|> there is no space between it and the comma.

??? The comma *is* a complete token. So the future change (which won't
happen, btw, since C9x has a different way to implement vararg macros)
would make the macros work as expected independent of whitespace. And, of
course, the whole thing is only relevant when the variable part is empty,
but i don't think the macros are currently ever used this way.

Andreas.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/