##

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.

-Eli

Eli Friedman schrieb:

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

Sascha Wildner schrieb:

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

Sorry that was meant to be

#define TEST1(a,b) a ## b
#define TEST2(a,b) a##b

Regards,
Sascha

Eli Friedman schrieb:

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.

Okay, I just fixed it in r72370.

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 '.'.

Concatenating two identifiers discards the RHS token; concatenating a
period with an identifier gets handled significantly differently.

-Eli

Eli Friedman schrieb: