Skip to content

Commit a771939

Browse files
bschommerxavierleroy
authored andcommitted
Small fixes for unknown-warning-option.
Using `Ignore` causes the compiler to ignore the next command line option, we shoud use `Unit` with an empty function. Also we need to check if there was any error during parsing the commandline for checking if an we have an unknown warning and the warning is set to an error. Bug 39421
1 parent 0cb76eb commit a771939

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

cparser/Diagnostics.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ let warning_options =
390390
Exact ("-Werror"), Unit werror;
391391
Exact ("-Wall"), Unit wall;
392392
Exact ("-w"), Unit wnothing;
393-
_Regexp("-Wno-.*$"), Ignore;
393+
_Regexp("-Wno-.*$"), Unit (fun () -> ());
394394
_Regexp("-W.*$"), Self unknown_warning;
395395
longopt_int ("-fmax-errors") ((:=) max_error);
396396
Exact("-fno-diagnostics-show-option"),Unset diagnostics_show_option;

driver/Driver.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ let _ =
427427
Printexc.record_backtrace true;
428428
Frontend.init ();
429429
parse_cmdline cmdline_actions;
430+
Diagnostics.raise_on_errors (); (* Any error for command line arguments? *)
430431
DebugInit.init (); (* Initialize the debug functions *)
431432
if nolink () && !option_o <> None && !num_source_files >= 2 then
432433
fatal_error no_loc "ambiguous '-o' option (multiple source files)";

0 commit comments

Comments
 (0)