diff options
| author | Kevin Enderby <enderby@apple.com> | 2013-01-22 21:44:53 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2013-01-22 21:44:53 +0000 |
| commit | 81c944cadb7f9e55b3517b7423a820e2577b9279 (patch) | |
| tree | f1317766fa4a8bbae640842e6803f3297bc5de4e /llvm/test | |
| parent | 10280a5ef4b090f810f70e08cbed743a66ab3a23 (diff) | |
| download | bcm5719-llvm-81c944cadb7f9e55b3517b7423a820e2577b9279.tar.gz bcm5719-llvm-81c944cadb7f9e55b3517b7423a820e2577b9279.zip | |
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
llvm-svn: 173199
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/MC/MachO/bad-macro.s | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/MC/MachO/bad-macro.s b/llvm/test/MC/MachO/bad-macro.s new file mode 100644 index 00000000000..0aaba099e85 --- /dev/null +++ b/llvm/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 |

