https://llvm.org/bugs/show_bug.cgi?id=25506
Bug ID: 25506 Summary: macro string concatenation does not generate the expected result in an assembly macro Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: oliv...@labapart.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified When the macro '#define CONCAT(a, b) CONCAT2(a, b)' is declared, Clang inserts the space between ',' and 'b' in the result when this macro is used in an assembly macro definition (ie: '.macro'). For instance the call CONCAT(a, b) in an assembly macro would generate the string 'a b' instead of 'ab'. This use case is actually present in newlib source code (https://sourceware.org/newlib/). GCC produces the expected result. If I replace '#define CONCAT(a, b) CONCAT2(a, b)' by '#define CONCAT(a, b) CONCAT2(a,b)' then the expected result is generated. Here is the example: ----- hello.S ----- /* ANSI concatenation macros. */ #define CONCAT(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a##b #ifndef __USER_LABEL_PREFIX__ #error __USER_LABEL_PREFIX__ not defined #endif #define SYM(x) CONCAT (__USER_LABEL_PREFIX__, x) .text .align bl SYM(setjmp) .macro FUNC_START name .text .align 2 .globl SYM (\name) SYM (\name): .endm FUNC_START setjmp bx lr ---------------------- $ clang-3.8 -target arm-none-eabi -c hello.S <instantiation>:3:18: error: unexpected token in directive .globl _ setjmp ^ hello.S:22:2: note: while in macro instantiation FUNC_START setjmp ^ <instantiation>:4:9: error: unexpected token in argument list _ setjmp: ^ hello.S:22:2: note: while in macro instantiation FUNC_START setjmp ^ -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs