On Thursday 05 February 2004 19:03, Alan Cox wrote:
> On Iau, 2004-02-05 at 17:47, Arnd Bergmann wrote:
> > Yes, that's a trivial bug which gcc-3.x happen to ignore. The answer to
> > why the space in front of a comma can be significant is left as an
> > excercise to the reader. To fix this, apply this mail as a patch.
>
> I don't believe its a bug gcc 3.x is ignoring but one that 2.96 tripped
> up on. There were several similar pasting problems with 2.9x when
> __FUNCTION__ use got tidied up in the x86 drivers.
Well, to be exact, older gcc version had their own varargs macro syntax,
which is used like
#define my_print(format,args...) printf(format , ## args)
where the ## operator removes the preceeding /preprocessor token/, while
newer gcc versions support c99 vararg macros like
#define my_print(format, ...) printf(format, ## __VA_ARGS__)
As an extension, the old format is still somewhat supported, but both
variants now have the ## operator remove exactly the comma preceeding
the varargs identifier, even if the comma does not follow whitespace
and is therefore not a seperate token.
The only way to write code that works on all gcc versions is to strictly
use the format documented in gcc-2.95.
Unfortunately, even the gcc-3.3 info page example is broken on gcc-2.95,
so that's really hard to find out.
Arnd <><