On 8 Nov 2001, Juan Quintela wrote:
>
> Hi
> this patch fixes the abuse of ## in alsa sources. It was used
> in ways that are not documented to work. It changes all the
> apparitions to ways that work in all the compilers and do what they
> are expected to do, changes are code of the form:
>
> #define FOO(args...) printk(bar, ##args)
>
> correct writting is:
>
> #define FOO(format, args...) printk(bar, foo, ##args)
>
> Notice that this is abused also in other creative ways, all the uses
> are changed to follow this last construct that is documented to work
> in last ANSI standard (and gcc documentation by the way).
>
> gcc-2.96 & gcc-3.0 don't like that construct, and notice that this was
> not valid C in the first place. Resulting code compile also witohut
> errors with egcs-1.1.2.
I would recommend to do same change as in the latest alsa drivers:
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define NEW_MACRO_VARARGS
#endif
#ifdef NEW_MACRO_VARARGS
/*
* VARARGS section
*/
#define snd_printk(...) do {\
printk("ALSA %s:%d: ", __FILE__, __LINE__); \
printk(__VA_ARGS__); \
} while (0)
#else
/*
* Old args section...
*/
#define snd_printk(args...) do {\
printk("ALSA %s:%d: ", __FILE__, __LINE__); \
printk(##args); \
} while (0)
#endif
We should retain the compilation compatibility with older GCC as well.
If you send me a patch in this way, I'll apply it.
Jaroslav
-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel