This is the mail archive of the 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]
Other format: [Raw text]

Re: Macro expansion works differently on ASM and C files. wrote:-

> Hi.  I have source with macros in it that use the "##" concatenation to
> construct assembly output.  The macros are expanded differently based on
> whether the file has a ".c" extension vs a ".S", with identical content
> (actually a symlink to the same file foo.S --> foo.c).
> The simple test case is:
>   #define FOO(a,b)    b,$##a
>   FOO   (a, b)
>   FOO  ( a, b)
> As 'foo.c' both FOO macro calls are expanded to "b,$a".  As 'foo.S' the second
> one is expanded to "b,$ a".  As you can see, I have a simple workaround, but
> it does look like a bug to me.

No, asm is different in several respects.  We don't permit dollars in
identifiers by default, for example, whereas we might with C files.

> The actual macro being used is:
>   #define SAVE_ONE(reg,bias)   mfc0 t0,$##reg; nop; sw t0,(reg*4)+bias(a0)
>   ...
>   SAVE_ONE ( 0, 0)
> This is a problem as the assembler chokes on "mfc0 t0,$ 0;" where "mfc0
> t0,$0;" is fine.    

Try -fdollars-in-identifiers?


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