2014-01-29 17:18:43 +08:00
|
|
|
// RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s
|
2010-07-19 03:00:10 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
|
|
|
|
|
|
|
|
.macro .test0
|
|
|
|
.macrobody0
|
2014-01-29 17:18:43 +08:00
|
|
|
.endm
|
2010-07-19 03:00:10 +08:00
|
|
|
.macro .test1
|
|
|
|
.test0
|
2014-01-29 17:18:43 +08:00
|
|
|
.endm
|
2010-07-19 03:00:10 +08:00
|
|
|
|
|
|
|
.test1
|
2012-05-02 02:38:27 +08:00
|
|
|
// CHECK-ERRORS: <instantiation>:1:1: error: unknown directive
|
2010-07-19 03:00:10 +08:00
|
|
|
// CHECK-ERRORS-NEXT: macrobody0
|
|
|
|
// CHECK-ERRORS-NEXT: ^
|
|
|
|
// CHECK-ERRORS: <instantiation>:1:1: note: while in macro instantiation
|
|
|
|
// CHECK-ERRORS-NEXT: .test0
|
|
|
|
// CHECK-ERRORS-NEXT: ^
|
|
|
|
// CHECK-ERRORS: 11:1: note: while in macro instantiation
|
|
|
|
// CHECK-ERRORS-NEXT: .test1
|
|
|
|
// CHECK-ERRORS-NEXT: ^
|
|
|
|
|
2014-01-29 17:18:43 +08:00
|
|
|
.macro test2 _a
|
|
|
|
.byte \_a
|
|
|
|
.endm
|
|
|
|
// CHECK: .byte 10
|
2010-07-19 03:00:10 +08:00
|
|
|
test2 10
|
|
|
|
|
2014-01-29 17:18:43 +08:00
|
|
|
.macro test3 _a _b _c
|
|
|
|
.ascii "\_a \_b \_c \\_c"
|
|
|
|
.endm
|
2010-07-19 03:00:10 +08:00
|
|
|
|
2014-01-29 17:18:43 +08:00
|
|
|
// CHECK: .ascii "1 2 3 \003"
|
|
|
|
test3 1, 2, 3
|
2012-09-20 04:36:12 +08:00
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1 2 3 \003"
|
|
|
|
test3 1, 2 3
|
|
|
|
|
|
|
|
.macro test3_prime _a _b _c
|
|
|
|
.ascii "\_a \_b \_c"
|
|
|
|
.endm
|
2010-08-11 01:38:52 +08:00
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1 (23) "
|
|
|
|
test3_prime 1, (2 3)
|
2010-08-11 01:38:52 +08:00
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1 (23) "
|
|
|
|
test3_prime 1 (2 3)
|
2012-09-20 04:36:12 +08:00
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1 2 "
|
|
|
|
test3_prime 1 2
|
2012-08-22 02:29:30 +08:00
|
|
|
|
|
|
|
.macro test5 _a
|
2014-01-29 17:18:43 +08:00
|
|
|
.globl \_a
|
2012-08-22 02:29:30 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
// CHECK: .globl zed1
|
2012-09-20 04:36:12 +08:00
|
|
|
test5 zed1
|
2012-08-22 02:29:30 +08:00
|
|
|
|
|
|
|
.macro test6 $a
|
2014-01-29 17:18:43 +08:00
|
|
|
.globl \$a
|
2012-08-22 02:29:30 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
// CHECK: .globl zed2
|
2012-09-20 04:36:12 +08:00
|
|
|
test6 zed2
|
2012-08-22 02:29:30 +08:00
|
|
|
|
|
|
|
.macro test7 .a
|
2014-01-29 17:18:43 +08:00
|
|
|
.globl \.a
|
2012-08-22 02:29:30 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
// CHECK: .globl zed3
|
2012-09-20 04:36:12 +08:00
|
|
|
test7 zed3
|
|
|
|
|
|
|
|
.macro test8 _a, _b, _c
|
2014-01-29 17:18:43 +08:00
|
|
|
.ascii "\_a,\_b,\_c"
|
|
|
|
.endm
|
2012-09-20 04:36:12 +08:00
|
|
|
|
|
|
|
.macro test9 _a _b _c
|
2014-01-29 17:18:43 +08:00
|
|
|
.ascii "\_a \_b \_c"
|
|
|
|
.endm
|
2012-09-20 04:36:12 +08:00
|
|
|
|
2014-01-29 17:18:43 +08:00
|
|
|
// CHECK: .ascii "a,b,c"
|
2012-09-20 04:36:12 +08:00
|
|
|
test8 a, b, c
|
2014-01-29 17:18:43 +08:00
|
|
|
// CHECK: .ascii "%1,%2,%3"
|
2012-09-20 04:36:12 +08:00
|
|
|
test8 %1 %2 %3 #a comment
|
2014-01-29 17:18:43 +08:00
|
|
|
// CHECK: .ascii "x-y,z,1"
|
2012-09-20 04:36:12 +08:00
|
|
|
test8 x - y z 1
|
2014-01-29 17:18:43 +08:00
|
|
|
// CHECK: .ascii "1 2 3"
|
2012-09-20 04:36:12 +08:00
|
|
|
test9 1, 2,3
|
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1,2,3"
|
2012-09-20 04:36:12 +08:00
|
|
|
test8 1,2 3
|
|
|
|
|
2014-01-30 02:57:46 +08:00
|
|
|
// CHECK: .ascii "1,2,3"
|
2012-09-20 04:36:12 +08:00
|
|
|
test8 1 2, 3
|
2014-02-20 21:36:32 +08:00
|
|
|
|
|
|
|
.macro test10
|
|
|
|
.ascii "$20"
|
|
|
|
.endm
|
|
|
|
|
|
|
|
test10
|
|
|
|
// CHECK: .ascii "$20"
|
|
|
|
|
|
|
|
test10 42
|
|
|
|
// CHECK-ERRORS: 102:10: error: Wrong number of arguments
|
|
|
|
// CHECK-ERRORS-NEXT: test10 42
|
|
|
|
// CHECK-ERRORS-NEXT: ^
|