[cfe-dev] ##

Sascha Wildner swildner at erpicon.de
Sun May 24 04:34:15 PDT 2009


Eli Friedman schrieb:
> On Sun, May 24, 2009 at 2:55 AM, Sascha Wildner <swildner at erpicon.de> wrote:
>> Hi all,
>>
>> I've noted a difference between gcc and clang using this test:
> 
> Is the difference significant to some program using clang's
> preprocessor output?  If so, please file a bug; otherwise, it doesn't
> really matter.  Making our -E output be byte-for-byte identical with
> gcc's output isn't very important.

Yes, it affects some assembler code which is generated by macros when 
building DragonFly BSD which uses __CONCAT(.,blah). I'll file a report 
for that.

Note that it does work, when "a##b" is used instead of "a ## b". And it 
does not generate an extra space in clang if 'a' isn't '.'.

So...

#define TEST1 a ## b
#define TEST2 a##b

TEST1(.,test) -> ".test" in gcc, ". test" in clang
TEST1(t,est)  -> "test" in both gcc and clang
TEST1(.te,st) -> ".test" in both gcc and clang

TEST2(.,test) -> ".test" in both gcc and clang
TEST2(t,est)  -> "test" in both gcc and clang
TEST2(.te,st) -> ".test" in both gcc and clang

Regards,
Sascha




More information about the cfe-dev mailing list