Token pasting
Jakub Jelinek
jakub@redhat.com
Mon Jan 8 02:53:00 GMT 2001
On Mon, Jan 08, 2001 at 11:44:02AM +0100, Philipp Thomas wrote:
> Hi Neil,
>
> while compiling latest CVS ALSA drivers with gcc 2.97, I get warnings like
> the following:
>
> warning: pasting "__module_generic_string_info_parm_snd_major" and "[" does not give a valid preprocessing token
>
> this results ultimately from this macro in alsas initval.h:
>
> #define MODULE_GENERIC_STRING(name, string) \
> static const char __module_generic_string_##name## [] \
> __attribute__ ((section(".modstring"))) = #name "=" string;
Use
#define MODULE_GENERIC_STRING(name, string) \
static const char __module_generic_string_##name [] \
__attribute__ ((section(".modstring"))) = #name "=" string;
instead. __module_generic_string_info_parm_snd_major[ is not a valid cpp
token and ISO C99 sais pasting which does not result in a valid
preprocessing token has undefined behaviour.
Jakub
More information about the Gcc
mailing list