MC: Unknown assembler directives are now hard errors.
authorJim Grosbach <grosbach@apple.com>
Tue, 1 May 2012 18:38:27 +0000 (18:38 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 1 May 2012 18:38:27 +0000 (18:38 +0000)
Previously, an unsupported/unknown assembler directive issued a warning.
That's generally unsafe, and inconsistent with the behaviour of pretty
much every system assembler. Now that the MC assemblers are mature
enough to be the default on multiple targets, it's reasonable to
issue errors for these.

For target or platform directives that need to stay warnings, we
should add explicit handlers for them in, e.g., ELFAsmParser.cpp,
DarwinAsmParser.cpp, et. al., and issue the warning there.

rdar://9246275

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155926 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/macros-parsing.s
test/MC/AsmParser/macros.s

index ec137e28913da8f8e55604c3e04657bd1320571b..25419916c71ee20ce6f6d7373071b85219069d8c 100644 (file)
@@ -1238,7 +1238,7 @@ bool AsmParser::ParseStatement() {
     if (!getTargetParser().ParseDirective(ID))
       return false;
 
-    return Warning(IDLoc, "ignoring directive for now");
+    return Error(IDLoc, "unknown directive");
   }
 
   CheckForValidSection();
index 65f64546cc130925758e9f19400fe31cf998d008..75aaac036ed1080f4217ce88ed3f3f0fda28d4ac 100644 (file)
@@ -5,7 +5,7 @@
 .endmacro
 
 .macros_off
-// CHECK-ERRORS: 9:1: warning: ignoring directive for now
+// CHECK-ERRORS: 9:1: error: unknown directive
 .test0
 .macros_on
 
index 214274d9aa845eeff9d992a6f08cbdc890192588..29575929923896a48ff14180adcb13e6c441e609 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
+// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
 // RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
 
 .macro .test0
@@ -9,7 +9,7 @@
 .endmacro
 
 .test1
-// CHECK-ERRORS: <instantiation>:1:1: warning: ignoring directive for now
+// CHECK-ERRORS: <instantiation>:1:1: error: unknown directive
 // CHECK-ERRORS-NEXT: macrobody0
 // CHECK-ERRORS-NEXT: ^
 // CHECK-ERRORS: <instantiation>:1:1: note: while in macro instantiation