From dd57a348664d0fac46a0f4c822f70c80bbf97774 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 25 Aug 2016 16:40:50 +0200 Subject: tccasm: Don't ignore # in preprocessor directives Our preprocessor throws away # line-comments in asm mode. It did so also inside preprocessor directives, thereby removing stringification. Parse defines in non-asm mode (but retain '.' as identifier character inside macro definitions). --- tests/asmtest.S | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'tests/asmtest.S') diff --git a/tests/asmtest.S b/tests/asmtest.S index 59deb06..280aeaf 100644 --- a/tests/asmtest.S +++ b/tests/asmtest.S @@ -16,10 +16,17 @@ .skip 3 .skip 15, 0x90 .string "hello\0world" - +/* Macro expansion should work like with C, the #n shouldn't be parsed + as asm line comment */ +#define __stringify(n) #n +#define stringify(n) __stringify(n) + .skip 8,0x90 + .asciz stringify(BLA) + .skip 8,0x90 + +# 28 "asmtest.S" # a line directive (and a line comment) + movl %eax, %ebx # some more asm comment /* some label tests */ - - movl %eax, %ebx L1: movl %eax, %ebx mov 0x10000, %eax @@ -572,8 +579,8 @@ int $0x10 pusha popa #endif - clc - cld + clc # another comment + cld # a comment with embedded ' tick cli clts cmc @@ -676,8 +683,10 @@ int $0x10 lar %eax,%dx lar %ax,%edx lar %eax,%edx +#ifdef __x86_64__ lar %ax,%rdx lar %eax,%rdx +#endif emms movd %edx, %mm3 movd 0x1000, %mm2 @@ -820,7 +829,11 @@ nop .long 145 + 2b .word 164, 0 .org 2b+32 +#ifdef __x86_64__ .quad 1b +#else + .long 1b +#endif .popsection 3: mov %eax,%ecx 4: -- cgit v1.3.1