summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--toplevel/topdirs.ml9
-rw-r--r--toplevel/toploop.ml1
-rw-r--r--toplevel/topmain.ml8
3 files changed, 13 insertions, 5 deletions
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml
index f7ae7c00b..c3fa8d934 100644
--- a/toplevel/topdirs.ml
+++ b/toplevel/topdirs.ml
@@ -233,8 +233,8 @@ let dir_untrace_all ppf () =
!traced_functions;
traced_functions := []
-let parse_warnings ppf s =
- try Warnings.parse_options s
+let parse_warnings ppf iserr s =
+ try Warnings.parse_options iserr s
with Arg.Bad err -> fprintf ppf "%s.@." err
let _ =
@@ -256,4 +256,7 @@ let _ =
(Directive_bool(fun b -> Clflags.classic := not b));
Hashtbl.add directive_table "warnings"
- (Directive_string (parse_warnings std_out))
+ (Directive_string (parse_warnings std_out false));
+
+ Hashtbl.add directive_table "warn_error"
+ (Directive_string (parse_warnings std_out true));
diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml
index 693762e15..fcc423cab 100644
--- a/toplevel/toploop.ml
+++ b/toplevel/toploop.ml
@@ -158,6 +158,7 @@ let execute_phrase print_outcome ppf phr =
| Ptop_def sstr ->
let (str, sg, newenv) = Typemod.type_structure !toplevel_env sstr in
let lam = Translmod.transl_toplevel_definition str in
+ Warnings.check_fatal ();
let res = load_lambda ppf lam in
begin match res with
| Result v ->
diff --git a/toplevel/topmain.ml b/toplevel/topmain.ml
index a34382995..69105668d 100644
--- a/toplevel/topmain.ml
+++ b/toplevel/topmain.ml
@@ -28,7 +28,7 @@ let main () =
"-noassert", Arg.Set noassert, " Do not compile assertion checks";
"-rectypes", Arg.Set recursive_types, " Allow arbitrary recursive types";
"-unsafe", Arg.Set fast, " No bound checking on array and string access";
- "-w", Arg.String Warnings.parse_options,
+ "-w", Arg.String (Warnings.parse_options false),
"<flags> Enable or disable warnings according to <flags>:\n\
\032 A/a enable/disable all warnings\n\
\032 C/c enable/disable suspicious comment\n\
@@ -40,11 +40,15 @@ let main () =
\032 V/v enable/disable hidden instance variable\n\
\032 X/x enable/disable all other warnings\n\
\032 default setting is A (all warnings enabled)";
+ "-warn-error" , Arg.String (Warnings.parse_options true),
+ "<flags> Enable or disable fatal warnings according to <flags>\n\
+ \032 (see option -w for the list of flags)\n\
+ \032 default setting is a (all warnings are non-fatal)";
"-dparsetree", Arg.Set dump_parsetree, " (undocumented)";
"-drawlambda", Arg.Set dump_rawlambda, " (undocumented)";
"-dlambda", Arg.Set dump_lambda, " (undocumented)";
- "-dinstr", Arg.Set dump_instr, " (undocumented)"
+ "-dinstr", Arg.Set dump_instr, " (undocumented)";
] file_argument usage;
Toploop.loop Format.std_formatter