diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2009-12-22 16:31:46 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2009-12-22 16:31:46 +0000 |
commit | 6f1e8fec9dbb731c33fe509994c109c46a4c9b8a (patch) | |
tree | 6d97a6fef9c5c0d54d8bb2496586a68e75e8b013 | |
parent | 1a69d6b1567d245f18e20a37c58f7a90baad232e (diff) |
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-- | VERSION | 2 | ||||
-rwxr-xr-x | boot/ocamldep | bin | 300623 -> 298527 bytes | |||
-rwxr-xr-x | boot/ocamllex | bin | 165419 -> 165431 bytes | |||
-rw-r--r-- | utils/warnings.ml | 22 |
4 files changed, 10 insertions, 14 deletions
@@ -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 Binary files differindex 178d8e4e8..ff3afb599 100755 --- a/boot/ocamldep +++ b/boot/ocamldep diff --git a/boot/ocamllex b/boot/ocamllex Binary files differindex 0db47b20f..123f7f15c 100755 --- a/boot/ocamllex +++ b/boot/ocamllex diff --git a/utils/warnings.ml b/utils/warnings.ml index 34e37a794..7a13c9079 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 |