This is the mail archive of the gcc-bugs@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: Serious error-causing change in new CPP's -traditional behavior


> In that case, I agree with Zack. You need to code something like:
> 
> #define HASH #    /* '#' isn't special on object-like macros */
> #define LPREFIX() HASH
> #define wibble (foo) mov    r0, LPREFIX()foo
> wibble (4)
> 
> This will also have the benefit of allowing you to change the literal prefix
> easily for different assemblers.


We were trying to avoid that particular contortion, but there are several 
other reasonable solutions.

#define IMMED(x) # ## x
#define wibble(foo) mov	r0, IMMED(foo)

or

#define wibble(foo) mov r0, # ## foo

or

#define wibble(foo) mov r0, #(foo) /* If brackets ok */

or

#define wibble(foo) mov r0, # /**/ foo  /* I think... not tested */

or

#define IMMED(x) x
#define wibble(foo) mov r0, #IMMED(foo)

etc.


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