This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Serious error-causing change in new CPP's -traditional behavior
- To: Dave Brolley <brolley at redhat dot com>
- Subject: Re: Serious error-causing change in new CPP's -traditional behavior
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Fri, 12 May 2000 18:44:20 +0100
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>, Neil Booth <NeilB at earthling dot net>, thorpej at zembu dot com, gcc-bugs at gcc dot gnu dot org
- Cc: rearnsha at arm dot com
- Organization: ARM Ltd.
- Reply-To: rearnsha at arm dot com
> 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.