From 38c271f6f921e30855c77666dbfab7e9c456e3d1 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 12 Apr 2020 08:14:37 -0700 Subject: [PATCH] [MC][test] Reorganize macro tests * Add locations * Use FileCheck --match-full-lines --strict-whitespace * Use CHECK-NEXT: * Merge related tests * Delete redundant tests * Improve test coverage Differential Revision: https://reviews.llvm.org/D77981 --- .../AsmParser/{macro-args.s => macro-arg-darwin.s} | 0 llvm/test/MC/AsmParser/macro-arg-err.s | 46 +++++++++ llvm/test/MC/AsmParser/macro-arg.s | 104 ++++++++++++++++++++ .../AsmParser/macro-def-in-instantiation-darwin.s | 13 +++ .../test/MC/AsmParser/macro-def-in-instantiation.s | 45 +++++---- .../AsmParser/macro-duplicate-params-names-err.s | 8 -- llvm/test/MC/AsmParser/macro-err1.s | 10 -- .../MC/AsmParser/macro-qualifier-diagnostics.s | 64 ------------- .../MC/AsmParser/macro-required-argument-err.s | 51 ++++++++++ ...macro-qualifier.s => macro-required-argument.s} | 0 llvm/test/MC/AsmParser/macro-unknown-directive.s | 19 ++++ .../macros-argument-parsing-diagnostics.s | 24 ----- llvm/test/MC/AsmParser/macros-argument-parsing.s | 91 ------------------ llvm/test/MC/AsmParser/macros-gas.s | 105 --------------------- llvm/test/MC/AsmParser/macros-off.s | 30 ++++++ llvm/test/MC/AsmParser/macros-parsing.s | 23 ----- 16 files changed, 284 insertions(+), 349 deletions(-) rename llvm/test/MC/AsmParser/{macro-args.s => macro-arg-darwin.s} (100%) create mode 100644 llvm/test/MC/AsmParser/macro-arg-err.s create mode 100644 llvm/test/MC/AsmParser/macro-arg.s create mode 100644 llvm/test/MC/AsmParser/macro-def-in-instantiation-darwin.s delete mode 100644 llvm/test/MC/AsmParser/macro-duplicate-params-names-err.s delete mode 100644 llvm/test/MC/AsmParser/macro-err1.s delete mode 100644 llvm/test/MC/AsmParser/macro-qualifier-diagnostics.s create mode 100644 llvm/test/MC/AsmParser/macro-required-argument-err.s rename llvm/test/MC/AsmParser/{macro-qualifier.s => macro-required-argument.s} (100%) create mode 100644 llvm/test/MC/AsmParser/macro-unknown-directive.s delete mode 100644 llvm/test/MC/AsmParser/macros-argument-parsing-diagnostics.s delete mode 100644 llvm/test/MC/AsmParser/macros-argument-parsing.s delete mode 100644 llvm/test/MC/AsmParser/macros-gas.s create mode 100644 llvm/test/MC/AsmParser/macros-off.s delete mode 100644 llvm/test/MC/AsmParser/macros-parsing.s diff --git a/llvm/test/MC/AsmParser/macro-args.s b/llvm/test/MC/AsmParser/macro-arg-darwin.s similarity index 100% rename from llvm/test/MC/AsmParser/macro-args.s rename to llvm/test/MC/AsmParser/macro-arg-darwin.s diff --git a/llvm/test/MC/AsmParser/macro-arg-err.s b/llvm/test/MC/AsmParser/macro-arg-err.s new file mode 100644 index 0000000..4aa27dd --- /dev/null +++ b/llvm/test/MC/AsmParser/macro-arg-err.s @@ -0,0 +1,46 @@ +# RUN: not llvm-mc -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace + +# CHECK:{{.*}}.s:[[#@LINE+3]]:22: error: macro 'dup_params' has multiple parameters named 'a' +# CHECK-NEXT:.macro dup_params a a +# CHECK-NEXT: ^ +.macro dup_params a a +# CHECK:{{.*}}.s:[[#@LINE+3]]:6: error: unexpected '.endm' in file, no current macro definition +# CHECK-NEXT:.endm +# CHECK-NEXT: ^ +.endm + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+6]]:14: error: too many positional arguments +# CHECK-NEXT:one_arg 42, 42 +# CHECK-NEXT: ^ +.macro one_arg bar + .long \bar +.endm +one_arg 42, 42 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+6]]:10: error: Wrong number of arguments +# CHECK-NEXT:no_arg 42 +# CHECK-NEXT: ^ +.macro no_arg +.ascii "$20" +.endm +no_arg 42 + +.macro double first = -1, second = -1 +.long \first +.long \second +.endm + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:14: error: too many positional arguments +# CHECK-NEXT:double 0, 1, 2 +# CHECK-NEXT: ^ +double 0, 1, 2 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:20: error: cannot mix positional and keyword arguments +# CHECK-NEXT:double second = 1, 2 +# CHECK-NEXT: ^ +double second = 1, 2 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:8: error: parameter named 'third' does not exist for macro 'double' +# CHECK-NEXT:double third = 0 +# CHECK-NEXT: ^ +double third = 0 diff --git a/llvm/test/MC/AsmParser/macro-arg.s b/llvm/test/MC/AsmParser/macro-arg.s new file mode 100644 index 0000000..a269873 --- /dev/null +++ b/llvm/test/MC/AsmParser/macro-arg.s @@ -0,0 +1,104 @@ +# RUN: llvm-mc -triple=x86_64 %s | FileCheck %s + +.macro empty, cond +.endm +empty ne + +# CHECK: .ascii "3 \003" +.macro escape a +.ascii "\a \\a" +.endm +escape 3 + +.macro double first = -1, second = -1 + .long \first + .long \second +.endm + +# CHECK: .long -1 +# CHECK-NEXT: .long -1 +# CHECK-EMPTY: +double +# CHECK: .long -1 +# CHECK-NEXT: .long -1 +# CHECK-EMPTY: +double , +# CHECK: .long 1 +# CHECK-NEXT: .long -1 +double 1 +# CHECK: .long 2 +# CHECK-NEXT: .long 3 +double 2, 3 +# CHECK: .long -1 +# CHECK-NEXT: .long 4 +double , 4 +# CHECK: .long 5 +# CHECK-NEXT: .long 6 +double 5, second = 6 +# CHECK: .long 7 +# CHECK-NEXT: .long -1 +double first = 7 +# CHECK: .long -1 +# CHECK-NEXT: .long 8 +double second = 8 +# CHECK: .long 10 +# CHECK-NEXT: .long 9 +double second = 9, first = 10 +# CHECK: .long second+11 +# CHECK-NEXT: .long -1 +double second + 11 +# CHECK: .long -1 +# CHECK-NEXT: .long second+12 +double , second + 12 +# CHECK: .long second +# CHECK-NEXT: .long -1 +double second + +.macro mixed arg0 = 0, arg1 = 1 arg2 = 2, arg3 = 3 + .long \arg0 + .long \arg1 + .long \arg2 + .long \arg3 +.endm + +# CHECK: .long 1 +# CHECK-NEXT: .long 2 +# CHECK-NEXT: .long 3 +# CHECK-NEXT: .long 3 +mixed 1, 2 3 + +# CHECK: .long 1 +# CHECK-NEXT: .long 2 +# CHECK-NEXT: .long 3 +# CHECK-NEXT: .long 3 +mixed 1 2, 3 + +# CHECK: .long 1 +# CHECK-NEXT: .long 2 +# CHECK-NEXT: .long 3 +# CHECK-NEXT: .long 4 +mixed 1 2, 3 4 + +.macro ascii3 _a _b _c +.ascii "\_a|\_b|\_c" +.endm + +## 3 arguments. +# CHECK: .ascii "a|b|c" +ascii3 a, b, c +# CHECK: .ascii "%1|%2|%3" +ascii3 %1 %2 %3 +# CHECK: .ascii "1|2|3" +ascii3 1, 2,3 +# CHECK: .ascii "1|2|3" +ascii3 1,2 3 +# CHECK: .ascii "1|2|3" +ascii3 1 2, 3 +# CHECK: .ascii "x-y|z|1" +ascii3 x - y z 1 + +## 2 arguments. +# CHECK: .ascii "1|(2 3)|" +ascii3 1, (2 3) +# CHECK: .ascii "1|(2 3)|" +ascii3 1 (2 3) diff --git a/llvm/test/MC/AsmParser/macro-def-in-instantiation-darwin.s b/llvm/test/MC/AsmParser/macro-def-in-instantiation-darwin.s new file mode 100644 index 0000000..6b77748 --- /dev/null +++ b/llvm/test/MC/AsmParser/macro-def-in-instantiation-darwin.s @@ -0,0 +1,13 @@ + # RUN: llvm-mc -triple=x86_64-apple-darwin10 %s | FileCheck %s + +.macro .make_macro +$0 $1 +$2 $3 +$4 +.endmacro + +.make_macro .macro,.mybyte,.byte,$0,.endmacro + +.data +# CHECK: .byte 10 +.mybyte 10 diff --git a/llvm/test/MC/AsmParser/macro-def-in-instantiation.s b/llvm/test/MC/AsmParser/macro-def-in-instantiation.s index 773df70..b6df62e 100644 --- a/llvm/test/MC/AsmParser/macro-def-in-instantiation.s +++ b/llvm/test/MC/AsmParser/macro-def-in-instantiation.s @@ -1,33 +1,30 @@ -// RUN: llvm-mc -triple x86_64-apple-darwin10 %s | FileCheck %s +# RUN: llvm-mc -triple=x86_64 %s | FileCheck %s +# RUN: llvm-mc -triple=x86_64-apple-darwin10 %s | FileCheck %s -.macro .make_macro -$0 $1 -$2 $3 -$4 -.endmacro - -.make_macro .macro,.mybyte,.byte,$0,.endmacro - -.data -// CHECK: .byte 10 -.mybyte 10 +.macro make_macro a, b, c ,d ,e, f +\a \b \c +\d \e +\f +.endm +make_macro .macro,mybyte,a,.byte,\a,.endm +# CHECK: .byte 42 +mybyte 42 -// PR18599 +# PR18599 .macro macro_a + .macro macro_b + .byte 10 + .macro macro_c + .endm -.macro macro_b -.byte 10 -.macro macro_c -.endm + macro_c + .purgem macro_c + .endm -macro_c -.purgem macro_c -.endm - -macro_b + macro_b .endm +# CHECK: .byte 10 +# CHECK: .byte 10 macro_a macro_b -// CHECK: .byte 10 -// CHECK: .byte 10 diff --git a/llvm/test/MC/AsmParser/macro-duplicate-params-names-err.s b/llvm/test/MC/AsmParser/macro-duplicate-params-names-err.s deleted file mode 100644 index b4e4fcb..0000000 --- a/llvm/test/MC/AsmParser/macro-duplicate-params-names-err.s +++ /dev/null @@ -1,8 +0,0 @@ -// REQUIRES: default_triple -// RUN: not llvm-mc %s 2> %t -// RUN: FileCheck < %t %s - -.macro M a a -.endm - -// CHECK: macro 'M' has multiple parameters named 'a' diff --git a/llvm/test/MC/AsmParser/macro-err1.s b/llvm/test/MC/AsmParser/macro-err1.s deleted file mode 100644 index bd9c837..0000000 --- a/llvm/test/MC/AsmParser/macro-err1.s +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2> %t -// RUN: FileCheck < %t %s - -.macro foo bar - .long \bar -.endm - -foo 42, 42 - -// CHECK: too many positional arguments diff --git a/llvm/test/MC/AsmParser/macro-qualifier-diagnostics.s b/llvm/test/MC/AsmParser/macro-qualifier-diagnostics.s deleted file mode 100644 index 4ebad2b..0000000 --- a/llvm/test/MC/AsmParser/macro-qualifier-diagnostics.s +++ /dev/null @@ -1,64 +0,0 @@ -# RUN: not llvm-mc -triple i386 -o /dev/null %s 2>&1 | FileCheck %s - - .macro missing_qualifier parameter: - -# CHECK: error: missing parameter qualifier for 'parameter' in macro 'missing_qualifier' -# CHECK: .macro missing_qualifier parameter: -# CHECK: ^ - - .macro non_identifier_qualifier parameter:0 - -# CHECK: error: missing parameter qualifier for 'parameter' in macro 'non_identifier_qualifier' -# CHECK: .macro non_identifier_qualifier parameter:0 -# CHECK: ^ - - .macro invalid_qualifier parameter:invalid_qualifier - -# CHECK: error: invalid_qualifier is not a valid parameter qualifier for 'parameter' in macro 'invalid_qualifier' -# CHECK: .macro invalid_qualifier parameter:invalid_qualifier -# CHECK: ^ - - .macro pointless_default parameter:req=default - .endm - -# CHECK: warning: pointless default value for required parameter 'parameter' in macro 'pointless_default' -# CHECK: .macro pointless_default parameter:req=default -# CHECK: ^ - - .macro missing_required_parameter parameter:req - .endm - - missing_required_parameter - -# CHECK: error: missing value for required parameter 'parameter' in macro 'missing_required_parameter' -# CHECK: missing_required_parameter -# CHECK: ^ - - .macro missing_second_required_argument first=0 second:req - .endm - - missing_second_required_argument - -# CHECK: error: missing value for required parameter 'second' in macro 'missing_second_required_argument' -# CHECK: missing_second_required_argument -# CHECK: ^ - - .macro second_third_required first=0 second:req third:req - .endm - - second_third_required 0 - -# CHECK: error: missing value for required parameter 'second' in macro 'second_third_required' -# CHECK: second_third_required 0 -# CHECK: ^ - -# CHECK: error: missing value for required parameter 'third' in macro 'second_third_required' -# CHECK: second_third_required 0 -# CHECK: ^ - - second_third_required third=3 first=1 - -# CHECK: error: missing value for required parameter 'second' in macro 'second_third_required' -# CHECK: second_third_required third=3 first=1 -# CHECK: ^ - diff --git a/llvm/test/MC/AsmParser/macro-required-argument-err.s b/llvm/test/MC/AsmParser/macro-required-argument-err.s new file mode 100644 index 0000000..4417171 --- /dev/null +++ b/llvm/test/MC/AsmParser/macro-required-argument-err.s @@ -0,0 +1,51 @@ +# RUN: not llvm-mc -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace + +# CHECK:{{.*}}.s:[[#@LINE+3]]:36: error: missing parameter qualifier for 'parameter' in macro 'missing_qualifier' +# CHECK-NEXT:.macro missing_qualifier parameter: +# CHECK-NEXT: ^ +.macro missing_qualifier parameter: + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:43: error: missing parameter qualifier for 'parameter' in macro 'non_identifier_qualifier' +# CHECK-NEXT:.macro non_identifier_qualifier parameter:0 +# CHECK-NEXT: ^ +.macro non_identifier_qualifier parameter:0 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:36: error: invalid_qualifier is not a valid parameter qualifier for 'parameter' in macro 'invalid_qualifier' +# CHECK-NEXT:.macro invalid_qualifier parameter:invalid_qualifier +# CHECK-NEXT: ^ +.macro invalid_qualifier parameter:invalid_qualifier + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:40: warning: pointless default value for required parameter 'parameter' in macro 'pointless_default' +# CHECK-NEXT:.macro pointless_default parameter:req=default +# CHECK-NEXT: ^ +.macro pointless_default parameter:req=default +.endm + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+5]]:17: error: missing value for required parameter 'parameter' in macro 'missing_required' +# CHECK-NEXT:missing_required +# CHECK-NEXT: ^ +.macro missing_required parameter:req +.endm +missing_required + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+5]]:24: error: missing value for required parameter 'second' in macro 'missing_second_required' +# CHECK-NEXT:missing_second_required +# CHECK-NEXT: ^ +.macro missing_second_required first=0 second:req +.endm +missing_second_required + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+8]]:24: error: missing value for required parameter 'second' in macro 'second_third_required' +# CHECK-NEXT:second_third_required 0 +# CHECK-NEXT: ^ +# CHECK-NEXT:{{.*}}.s:[[#@LINE+5]]:24: error: missing value for required parameter 'third' in macro 'second_third_required' +# CHECK-NEXT:second_third_required 0 +# CHECK-NEXT: ^ +.macro second_third_required first=0 second:req third:req +.endm +second_third_required 0 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:38: error: missing value for required parameter 'second' in macro 'second_third_required' +# CHECK-NEXT:second_third_required third=3 first=1 +# CHECK-NEXT: ^ +second_third_required third=3 first=1 diff --git a/llvm/test/MC/AsmParser/macro-qualifier.s b/llvm/test/MC/AsmParser/macro-required-argument.s similarity index 100% rename from llvm/test/MC/AsmParser/macro-qualifier.s rename to llvm/test/MC/AsmParser/macro-required-argument.s diff --git a/llvm/test/MC/AsmParser/macro-unknown-directive.s b/llvm/test/MC/AsmParser/macro-unknown-directive.s new file mode 100644 index 0000000..6ae3a61 --- /dev/null +++ b/llvm/test/MC/AsmParser/macro-unknown-directive.s @@ -0,0 +1,19 @@ +# RUN: not llvm-mc -triple x86_64 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace + +# CHECK::1:1: error: unknown directive +# CHECK-NEXT:.macrobody0 +# CHECK-NEXT:^ +# CHECK-NEXT::1:1: note: while in macro instantiation +# CHECK-NEXT:.test0 +# CHECK-NEXT:^ +# CHECK-NEXT:{{.*}}.s:[[#@LINE+10]]:1: note: while in macro instantiation +# CHECK-NEXT:.test1 +# CHECK-NEXT:^ +.macro .test0 +.macrobody0 +.endm +.macro .test1 +.test0 +.endm + +.test1 diff --git a/llvm/test/MC/AsmParser/macros-argument-parsing-diagnostics.s b/llvm/test/MC/AsmParser/macros-argument-parsing-diagnostics.s deleted file mode 100644 index a1970e0..0000000 --- a/llvm/test/MC/AsmParser/macros-argument-parsing-diagnostics.s +++ /dev/null @@ -1,24 +0,0 @@ -# RUN: not llvm-mc -triple i386 -filetype asm -o /dev/null %s 2>&1 | FileCheck %s - - .macro double first = -1, second = -1 - # begin entry - .long \first - .long \second - # end entry - .endm - - double 0, 1, 2 -# CHECK: error: too many positional arguments -# CHECK: double 0, 1, 2 -# CHECK: ^ - - double second = 1, 2 -# CHECK: error: cannot mix positional and keyword arguments -# CHECK: double second = 1, 2 -# CHECK: ^ - - double third = 0 -# CHECK: error: parameter named 'third' does not exist for macro 'double' -# CHECK: double third = 0 -# CHECK: ^ - diff --git a/llvm/test/MC/AsmParser/macros-argument-parsing.s b/llvm/test/MC/AsmParser/macros-argument-parsing.s deleted file mode 100644 index 39242cf..0000000 --- a/llvm/test/MC/AsmParser/macros-argument-parsing.s +++ /dev/null @@ -1,91 +0,0 @@ -# RUN: llvm-mc -triple i386 -filetype asm -o - %s | FileCheck %s - - .macro it, cond - .endm - - it ne - .long 1 - -# CHECK: .long 1 - - .macro double first = -1, second = -1 - # begin entry - .long \first - .long \second - # end entry - .endm - - double -# CHECK: .long -1 -# CHECK: .long -1 - - double 1 -# CHECK: .long 1 -# CHECK: .long -1 - - double 2, 3 -# CHECK: .long 2 -# CHECK: .long 3 - - double , 4 -# CHECK: .long -1 -# CHECK: .long 4 - - double 5, second = 6 -# CHECK: .long 5 -# CHECK: .long 6 - - double first = 7 -# CHECK: .long 7 -# CHECK: .long -1 - - double second = 8 -# CHECK: .long -1 -# CHECK: .long 8 - - double second = 9, first = 10 -# CHECK: .long 10 -# CHECK: .long 9 - - double second + 11 -# CHECK: .long second+11 -# CHECK: .long -1 - - double , second + 12 -# CHECK: .long -1 -# CHECK: .long second+12 - - double second -# CHECK: .long second -# CHECK: .long -1 - - .macro mixed arg0 = 0, arg1 = 1 arg2 = 2, arg3 = 3 - # begin entry - .long \arg0 - .long \arg1 - .long \arg2 - .long \arg3 - # end entry - .endm - -mixed 1, 2 3 - -# CHECK: .long 1 -# CHECK: .long 2 -# CHECK: .long 3 -# CHECK: .long 3 - -mixed 1 2, 3 - -# CHECK: .long 1 -# CHECK: .long 2 -# CHECK: .long 3 -# CHECK: .long 3 - -mixed 1 2, 3 4 - -# CHECK: .long 1 -# CHECK: .long 2 -# CHECK: .long 3 -# CHECK: .long 4 - diff --git a/llvm/test/MC/AsmParser/macros-gas.s b/llvm/test/MC/AsmParser/macros-gas.s deleted file mode 100644 index b88058e..0000000 --- a/llvm/test/MC/AsmParser/macros-gas.s +++ /dev/null @@ -1,105 +0,0 @@ -// RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s -// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err - -.macro .test0 -.macrobody0 -.endm -.macro .test1 -.test0 -.endm - -.test1 -// CHECK-ERRORS: :1:1: error: unknown directive -// CHECK-ERRORS-NEXT: macrobody0 -// CHECK-ERRORS-NEXT: ^ -// CHECK-ERRORS: :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: ^ - -.macro test2 _a -.byte \_a -.endm -// CHECK: .byte 10 -test2 10 - -.macro test3 _a _b _c -.ascii "\_a \_b \_c \\_c" -.endm - -// CHECK: .ascii "1 2 3 \003" -test3 1, 2, 3 - -// CHECK: .ascii "1 2 3 \003" -test3 1, 2 3 - -.macro test3_prime _a _b _c -.ascii "\_a \_b \_c" -.endm - -// CHECK: .ascii "1 (2 3) " -test3_prime 1, (2 3) - -// CHECK: .ascii "1 (2 3) " -test3_prime 1 (2 3) - -// CHECK: .ascii "1 2 " -test3_prime 1 2 - -.macro test5 _a -.globl \_a -.endm - -// CHECK: .globl zed1 -test5 zed1 - -.macro test6 $a -.globl \$a -.endm - -// CHECK: .globl zed2 -test6 zed2 - -.macro test7 .a -.globl \.a -.endm - -// CHECK: .globl zed3 -test7 zed3 - -.macro test8 _a, _b, _c -.ascii "\_a,\_b,\_c" -.endm - -.macro test9 _a _b _c -.ascii "\_a \_b \_c" -.endm - -// CHECK: .ascii "a,b,c" -test8 a, b, c -// CHECK: .ascii "%1,%2,%3" -test8 %1 %2 %3 #a comment -// CHECK: .ascii "x-y,z,1" -test8 x - y z 1 -// CHECK: .ascii "1 2 3" -test9 1, 2,3 - -// CHECK: .ascii "1,2,3" -test8 1,2 3 - -// CHECK: .ascii "1,2,3" -test8 1 2, 3 - -.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: ^ diff --git a/llvm/test/MC/AsmParser/macros-off.s b/llvm/test/MC/AsmParser/macros-off.s new file mode 100644 index 0000000..5a43a5d --- /dev/null +++ b/llvm/test/MC/AsmParser/macros-off.s @@ -0,0 +1,30 @@ +# RUN: not llvm-mc -triple x86_64 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace +# RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -o /dev/null 2>&1 | FileCheck %s --match-full-lines --strict-whitespace + +.macro .test0 +.endmacro + +.macros_off +# CHECK:{{.*}}.s:[[#@LINE+3]]:1: error: unknown directive +# CHECK-NEXT:.test0 +# CHECK-NEXT:^ +.test0 +.macros_on + +.test0 + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:1: error: macro '.test0' is already defined +# CHECK-NEXT:.macro .test0 +# CHECK-NEXT:^ +.macro .test0 +.endmacro + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:10: error: unexpected '.endmacro' in file, no current macro definition +# CHECK-NEXT:.endmacro +# CHECK-NEXT: ^ +.endmacro + +# CHECK-NEXT:{{.*}}.s:[[#@LINE+3]]:1: error: no matching '.endmacro' in definition +# CHECK-NEXT:.macro dummy +# CHECK-NEXT:^ +.macro dummy diff --git a/llvm/test/MC/AsmParser/macros-parsing.s b/llvm/test/MC/AsmParser/macros-parsing.s deleted file mode 100644 index 75aaac0..0000000 --- a/llvm/test/MC/AsmParser/macros-parsing.s +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err -// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err - -.macro .test0 -.endmacro - -.macros_off -// CHECK-ERRORS: 9:1: error: unknown directive -.test0 -.macros_on - -.test0 - -// CHECK-ERRORS: macro '.test0' is already defined -.macro .test0 -.endmacro - -// CHECK-ERRORS: unexpected '.endmacro' in file -.endmacro - -// CHECK-ERRORS: no matching '.endmacro' in definition -.macro dummy - -- 2.7.4