This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Token pasting


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]