summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2009-12-22 16:31:46 +0000
committerDamien Doligez <damien.doligez-inria.fr>2009-12-22 16:31:46 +0000
commit6f1e8fec9dbb731c33fe509994c109c46a4c9b8a (patch)
tree6d97a6fef9c5c0d54d8bb2496586a68e75e8b013
parent1a69d6b1567d245f18e20a37c58f7a90baad232e (diff)
downloadocaml-6f1e8fec9dbb731c33fe509994c109c46a4c9b8a.tar.gz
PR#4947 bug in parsing of warning options
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9485 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--VERSION2
-rwxr-xr-xboot/ocamldepbin300623 -> 298527 bytes
-rwxr-xr-xboot/ocamllexbin165419 -> 165431 bytes
-rw-r--r--utils/warnings.ml22
4 files changed, 10 insertions, 14 deletions
diff --git a/VERSION b/VERSION
index 858f084136..dd4ae5c00d 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-3.12.0+dev12 (2009-12-01)
+3.12.0+dev13 (2009-12-22)
# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
diff --git a/boot/ocamldep b/boot/ocamldep
index 178d8e4e8e..ff3afb5999 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 0db47b20f4..123f7f15c5 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/utils/warnings.ml b/utils/warnings.ml
index 34e37a7943..7a13c9079f 100644
--- a/utils/warnings.ml
+++ b/utils/warnings.ml
@@ -129,13 +129,14 @@ let is_active x = active.(number x);;
let is_error x = error.(number x);;
let parse_opt flags s =
+ let check i =
+ if i < 1 || i > last_warning_number then
+ raise (Arg.Bad "Bad warning number");
+ in
let set i = flags.(i) <- true in
let clear i = flags.(i) <- false in
let set_all i = active.(i) <- true; error.(i) <- true in
- let error () =
- let msg = Printf.sprintf "Ill-formed list of warnings" in
- raise (Arg.Bad msg)
- in
+ let error () = raise (Arg.Bad "Ill-formed list of warnings") in
let rec loop i =
if i >= String.length s then () else
match s.[i] with
@@ -161,17 +162,12 @@ let parse_opt flags s =
loop (i+1)
| _ -> error ()
and loop_num myset i n =
- if i >= String.length s then begin
- if n < 1 || n > last_warning_number then begin
- let msg = Printf.sprintf "Bad warning number %d" n in
- raise (Arg.Bad msg)
- end else begin
- myset n
- end
- end else
+ if i >= String.length s then myset n else
match s.[i] with
| '0' .. '9' ->
- loop_num myset (i+1) (10 * n + Char.code s.[i] - Char.code '0')
+ let nn = 10 * n + Char.code s.[i] - Char.code '0' in
+ check nn;
+ loop_num myset (i+1) nn
| _ -> myset n; loop i
in
loop 0