summaryrefslogtreecommitdiff
path: root/test/MC/MachO
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2013-01-22 21:44:53 +0000
committerKevin Enderby <enderby@apple.com>2013-01-22 21:44:53 +0000
commit221514efe92676ce84a5e21bea91d8a6b21f9ed7 (patch)
tree34436ca7a36108724cd3ea8d30b7f7b75d9c7cdb /test/MC/MachO
parenta88322c283a001019bd5cd4ddeafc425cc4d00af (diff)
downloadllvm-221514efe92676ce84a5e21bea91d8a6b21f9ed7.tar.gz
llvm-221514efe92676ce84a5e21bea91d8a6b21f9ed7.tar.bz2
llvm-221514efe92676ce84a5e21bea91d8a6b21f9ed7.tar.xz
Add a warning when there is a macro defintion that has named parameters but
the body does not use them and it appears the body has positional parameters. This can cause unexpected results as in the added test case. As the darwin version of gas(1) which only supported positional parameters, happened to ignore the named parameters. Now that we want to support both styles of macros we issue a warning in this specific case. rdar://12861644 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/MachO')
-rw-r--r--test/MC/MachO/bad-macro.s14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/MC/MachO/bad-macro.s b/test/MC/MachO/bad-macro.s
new file mode 100644
index 0000000000..0aaba099e8
--- /dev/null
+++ b/test/MC/MachO/bad-macro.s
@@ -0,0 +1,14 @@
+// RUN: llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err > %t
+// RUN: FileCheck --check-prefix=CHECK-OUTPUT < %t %s
+// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s
+
+.macro test_macro reg1, reg2
+mov $1, %eax
+mov $2, %eax
+.endmacro
+test_macro %ebx, %ecx
+
+// CHECK-ERROR: 5:1: warning: macro defined with named parameters which are not used in macro body, possible positional parameter found in body which will have no effect
+
+// CHECK-OUTPUT: movl $1, %eax
+// CHECK-OUTPUT: movl $2, %eax