summaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorPreston Gurd <preston.gurd@intel.com>2012-09-19 20:36:12 +0000
committerPreston Gurd <preston.gurd@intel.com>2012-09-19 20:36:12 +0000
commit7b6f2034ac355bd3b3cc88960bf8d0e694fe3db4 (patch)
tree1fbf98d382ccd9fe5d7e82c169df126848015ffc /test/MC
parent4caf5281bf9cbdbc13758a6f2b965b0e9ef233d3 (diff)
downloadllvm-7b6f2034ac355bd3b3cc88960bf8d0e694fe3db4.tar.gz
llvm-7b6f2034ac355bd3b3cc88960bf8d0e694fe3db4.tar.bz2
llvm-7b6f2034ac355bd3b3cc88960bf8d0e694fe3db4.tar.xz
Add support for macro parameters/arguments delimited by spaces,
to improve compatibility with GNU as. Based on a patch by PaX Team. Fixed assertion failures on non-Darwin and added additional test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/AsmParser/macros-darwin.s9
-rw-r--r--test/MC/AsmParser/macros.s49
2 files changed, 50 insertions, 8 deletions
diff --git a/test/MC/AsmParser/macros-darwin.s b/test/MC/AsmParser/macros-darwin.s
new file mode 100644
index 0000000000..31b9edb378
--- /dev/null
+++ b/test/MC/AsmParser/macros-darwin.s
@@ -0,0 +1,9 @@
+// RUN: not llvm-mc -triple i386-apple-darwin10 %s 2> %t.err | FileCheck %s
+
+.macro test1
+.globl "$0 $1 $2 $$3 $n"
+.endmacro
+
+// CHECK: .globl "1 23 $3 2"
+test1 1, 2 3
+
diff --git a/test/MC/AsmParser/macros.s b/test/MC/AsmParser/macros.s
index dd2cc1f149..b1cb851fcd 100644
--- a/test/MC/AsmParser/macros.s
+++ b/test/MC/AsmParser/macros.s
@@ -1,4 +1,4 @@
-// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
+// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t.err | FileCheck %s
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
.macro .test0
@@ -28,33 +28,66 @@ test2 10
.globl "$0 $1 $2 $$3 $n"
.endmacro
-// CHECK: .globl "1 23 $3 2"
-test3 1,2 3
+// CHECK: .globl "1 (23) $3 2"
+test3 1, (2 3)
+
+// CHECK: .globl "1 2 $3 2"
+test3 1 2
.macro test4
.globl "$0 -- $1"
.endmacro
-// CHECK: .globl "ab)(,) -- (cd)"
-test4 a b)(,),(cd)
+// CHECK: .globl "(ab)(,)) -- (cd)"
+test4 (a b)(,)),(cd)
+
+// CHECK: .globl "(ab)(,)) -- (cd)"
+test4 (a b)(,)),(cd)
.macro test5 _a
.globl "\_a"
.endm
-test5 zed1
// CHECK: .globl zed1
+test5 zed1
.macro test6 $a
.globl "\$a"
.endm
-test6 zed2
// CHECK: .globl zed2
+test6 zed2
.macro test7 .a
.globl "\.a"
.endm
-test7 zed3
// CHECK: .globl zed3
+test7 zed3
+
+.macro test8 _a, _b, _c
+.globl "\_a,\_b,\_c"
+.endmacro
+
+.macro test9 _a _b _c
+.globl "\_a \_b \_c"
+.endmacro
+
+// CHECK: .globl "a,b,c"
+test8 a, b, c
+// CHECK: .globl "%1,%2,%3"
+test8 %1 %2 %3 #a comment
+// CHECK: .globl "x-y,z,1"
+test8 x - y z 1
+// CHECK: .globl "1 2 3"
+test9 1, 2,3
+
+test8 1,2 3
+// CHECK-ERRORS: error: macro argument '_c' is missing
+// CHECK-ERRORS-NEXT: test8 1,2 3
+// CHECK-ERRORS-NEXT: ^
+
+test8 1 2, 3
+// CHECK-ERRORS: error: expected ' ' for macro argument separator
+// CHECK-ERRORS-NEXT:test8 1 2, 3
+// CHECK-ERRORS-NEXT: ^