Version française
Home     About     Download     Resources     Contact us    
Browse thread
change warning to error?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David.Mentre@i...
Subject: Re: change warning to error?
Norman Ramsey <nr@eecs.harvard.edu> writes:

> Is it possible to instruct ocamlc that the `partial match' warning
> should be treated as an error, i.e., that it stop compilation and
> produce no output? 

It's free software, so "Use the source Luke".  ;)


After applying the follwing patch:
----
        Objective Caml version 3.00-abort-partial-match

# let is_zero  0 =true;;
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
1
Interrupted.
#
----


--- ocaml-3.00/parsing/location.ml      Mon Mar  6 23:11:37 2000
+++ ocaml-3.00-modif/parsing/location.ml        Fri Aug  4 11:04:07 2000
@@ -116,8 +116,14 @@
 
 let print_warning loc ppf w =
  if Warnings.is_active w then begin
-  fprintf ppf "%aWarning: %s@." print loc (Warnings.message w);
-  incr num_loc_lines;
+   match w with
+   | Warnings.Partial_match err -> (
+       fprintf ppf "%aWarning: %s@." print loc (Warnings.message w);
+       raise Sys.Break
+      )
+   | _ ->
+       fprintf ppf "%aWarning: %s@." print loc (Warnings.message w);
+       incr num_loc_lines;
  end
 ;;
 
Only in ocaml-3.00-modif/stdlib: caml
diff -cru ocaml-3.00/utils/config.mlp ocaml-3.00-modif/utils/config.mlp
--- ocaml-3.00/utils/config.mlp Fri Apr 21 13:54:35 2000
+++ ocaml-3.00-modif/utils/config.mlp   Fri Aug  4 11:11:55 2000
@@ -12,7 +12,7 @@
 
 (* $Id: config.mlp,v 1.132 2000/04/21 11:54:35 xleroy Exp $ *)
 
-let version = "3.00"
+let version = "3.00-abort-partial-match"
 
 let standard_library =
   try


Best regards,
-- 
 David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/
 Opinions expressed here are only mine.