Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David.Mentre@irisa.fr (David Mentré)
To: Norman Ramsey <nr@eecs.harvard.edu>
Cc: caml-list@inria.fr
Subject: Re: change warning to error?
Date: 04 Aug 2000 11:18:28 +0200	[thread overview]
Message-ID: <wd8punpv0yj.fsf@parate.irisa.fr> (raw)
In-Reply-To: Norman Ramsey's message of "Tue, 1 Aug 2000 17:45:44 -0400"

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.



      parent reply	other threads:[~2000-08-04 17:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-01 21:45 Norman Ramsey
2000-08-02 17:03 ` Hendrik Tews
2000-08-02 22:10 ` John Max Skaller
2000-08-04  9:18 ` David Mentré [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wd8punpv0yj.fsf@parate.irisa.fr \
    --to=david.mentre@irisa.fr \
    --cc=caml-list@inria.fr \
    --cc=nr@eecs.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox