mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[ms] [llvm-ml] Accept /WX to signal that warnings should be fatal.
Define -fatal-warnings to make warnings fatal, and accept /WX as an ML.EXE compatible alias for it. Also make sure that if Warning() returns true, we always treat it as an error. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D92504
This commit is contained in:
parent
9bba5888d6
commit
e5b828d67b
@ -4473,8 +4473,9 @@ bool MasmParser::parseDirectiveAlign() {
|
|||||||
return addErrorSuffix(" in align directive");
|
return addErrorSuffix(" in align directive");
|
||||||
// Ignore empty 'align' directives.
|
// Ignore empty 'align' directives.
|
||||||
if (getTok().is(AsmToken::EndOfStatement)) {
|
if (getTok().is(AsmToken::EndOfStatement)) {
|
||||||
Warning(AlignmentLoc, "align directive with no operand is ignored");
|
return Warning(AlignmentLoc,
|
||||||
return parseToken(AsmToken::EndOfStatement);
|
"align directive with no operand is ignored") &&
|
||||||
|
parseToken(AsmToken::EndOfStatement);
|
||||||
}
|
}
|
||||||
if (parseAbsoluteExpression(Alignment) ||
|
if (parseAbsoluteExpression(Alignment) ||
|
||||||
parseToken(AsmToken::EndOfStatement))
|
parseToken(AsmToken::EndOfStatement))
|
||||||
|
10
test/tools/llvm-ml/hexfloat_error.asm
Normal file
10
test/tools/llvm-ml/hexfloat_error.asm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
; RUN: not llvm-ml -filetype=s %s /WX /Fo /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
; CHECK: :[[# @LINE + 1]]:25: error: MASM-style hex floats ignore explicit sign
|
||||||
|
negative_hexfloat REAL4 -3fa66666r
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
END
|
12
test/tools/llvm-ml/hexfloat_warn.asm
Normal file
12
test/tools/llvm-ml/hexfloat_warn.asm
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
; RUN: llvm-ml -filetype=s %s /Fo - 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
; CHECK: :[[# @LINE + 1]]:25: warning: MASM-style hex floats ignore explicit sign
|
||||||
|
negative_hexfloat REAL4 -3fa66666r
|
||||||
|
; CHECK-LABEL: negative_hexfloat:
|
||||||
|
; CHECK-NEXT: .long 1067869798
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
END
|
@ -31,6 +31,8 @@ def bitness : LLVMJoined<"m">, Values<"32,64">,
|
|||||||
HelpText<"Target platform (x86 or x86-64)">;
|
HelpText<"Target platform (x86 or x86-64)">;
|
||||||
def as_lex : LLVMFlag<"as-lex">,
|
def as_lex : LLVMFlag<"as-lex">,
|
||||||
HelpText<"Lex tokens from a .asm file without assembling">;
|
HelpText<"Lex tokens from a .asm file without assembling">;
|
||||||
|
def fatal_warnings : LLVMFlag<"fatal-warnings">,
|
||||||
|
HelpText<"Treat warnings as errors">;
|
||||||
def filetype : LLVMJoined<"filetype=">, Values<"obj,s,null">,
|
def filetype : LLVMJoined<"filetype=">, Values<"obj,s,null">,
|
||||||
HelpText<"Emit a file with the given type">;
|
HelpText<"Emit a file with the given type">;
|
||||||
def output_att_asm : LLVMFlag<"output-att-asm">,
|
def output_att_asm : LLVMFlag<"output-att-asm">,
|
||||||
@ -68,6 +70,7 @@ def safeseh : MLFlag<"safeseh">,
|
|||||||
def assembly_file : MLJoinedOrSeparate<"Ta">,
|
def assembly_file : MLJoinedOrSeparate<"Ta">,
|
||||||
HelpText<"Assemble source file with name not ending with "
|
HelpText<"Assemble source file with name not ending with "
|
||||||
"the .asm extension">;
|
"the .asm extension">;
|
||||||
|
def error_on_warning : MLFlag<"WX">, Alias<fatal_warnings>;
|
||||||
def parse_only : MLFlag<"Zs">, HelpText<"Run a syntax-check only">,
|
def parse_only : MLFlag<"Zs">, HelpText<"Run a syntax-check only">,
|
||||||
Alias<filetype>, AliasArgs<["null"]>;
|
Alias<filetype>, AliasArgs<["null"]>;
|
||||||
|
|
||||||
@ -102,7 +105,6 @@ def listing_title : UnsupportedSeparate<"St">, HelpText<"">;
|
|||||||
def listing_false_conditionals : UnsupportedFlag<"Sx">, HelpText<"">;
|
def listing_false_conditionals : UnsupportedFlag<"Sx">, HelpText<"">;
|
||||||
def extra_warnings : UnsupportedFlag<"w">, HelpText<"">;
|
def extra_warnings : UnsupportedFlag<"w">, HelpText<"">;
|
||||||
def warning_level : UnsupportedJoined<"W">, HelpText<"">;
|
def warning_level : UnsupportedJoined<"W">, HelpText<"">;
|
||||||
def error_on_warning : UnsupportedFlag<"WX">, HelpText<"">;
|
|
||||||
def ignore_include_envvar : UnsupportedFlag<"X">, HelpText<"">;
|
def ignore_include_envvar : UnsupportedFlag<"X">, HelpText<"">;
|
||||||
def line_number_info : UnsupportedFlag<"Zd">, HelpText<"">;
|
def line_number_info : UnsupportedFlag<"Zd">, HelpText<"">;
|
||||||
def export_all_symbols : UnsupportedFlag<"Zf">, HelpText<"">;
|
def export_all_symbols : UnsupportedFlag<"Zf">, HelpText<"">;
|
||||||
|
@ -231,6 +231,7 @@ int main(int Argc, char **Argv) {
|
|||||||
|
|
||||||
MCTargetOptions MCOptions;
|
MCTargetOptions MCOptions;
|
||||||
MCOptions.AssemblyLanguage = "masm";
|
MCOptions.AssemblyLanguage = "masm";
|
||||||
|
MCOptions.MCFatalWarnings = InputArgs.hasArg(OPT_fatal_warnings);
|
||||||
|
|
||||||
Triple TheTriple = GetTriple(ProgName, InputArgs);
|
Triple TheTriple = GetTriple(ProgName, InputArgs);
|
||||||
std::string Error;
|
std::string Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user