From 758e0cc94af7e146c948aadaf81e2667287c777b Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Tue, 1 May 2012 18:38:27 +0000 Subject: [PATCH] MC: Unknown assembler directives are now hard errors. 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 llvm-svn: 155926 --- llvm/lib/MC/MCParser/AsmParser.cpp | 2 +- llvm/test/MC/AsmParser/macros-parsing.s | 2 +- llvm/test/MC/AsmParser/macros.s | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index ec137e28913d..25419916c71e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -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(); diff --git a/llvm/test/MC/AsmParser/macros-parsing.s b/llvm/test/MC/AsmParser/macros-parsing.s index 65f64546cc13..75aaac036ed1 100644 --- a/llvm/test/MC/AsmParser/macros-parsing.s +++ b/llvm/test/MC/AsmParser/macros-parsing.s @@ -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 diff --git a/llvm/test/MC/AsmParser/macros.s b/llvm/test/MC/AsmParser/macros.s index 214274d9aa84..295759299238 100644 --- a/llvm/test/MC/AsmParser/macros.s +++ b/llvm/test/MC/AsmParser/macros.s @@ -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: :1:1: warning: ignoring directive for now +// CHECK-ERRORS: :1:1: error: unknown directive // CHECK-ERRORS-NEXT: macrobody0 // CHECK-ERRORS-NEXT: ^ // CHECK-ERRORS: :1:1: note: while in macro instantiation