aboutsummaryrefslogtreecommitdiffstats
path: root/driver/Commandline.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-01-03 09:28:41 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-01-03 09:28:41 +0100
commit1278e187ddc2aa3623002b1af2dc402eb735eb16 (patch)
tree3f2fe8a8b83b5dc25bda513a462428af2d33d2db /driver/Commandline.ml
parent334be23a90a700f3b62806e1178603a28c6ba3bb (diff)
downloadcompcert-1278e187ddc2aa3623002b1af2dc402eb735eb16.tar.gz
compcert-1278e187ddc2aa3623002b1af2dc402eb735eb16.zip
PR#16: give option rules precedence over file pattern rules.
Plus: simplify handling of -help and --help. Plus: error on unrecognized "-xxx" options so that "-foo.c" is not treated as a source file.
Diffstat (limited to 'driver/Commandline.ml')
-rw-r--r--driver/Commandline.ml11
1 files changed, 4 insertions, 7 deletions
diff --git a/driver/Commandline.ml b/driver/Commandline.ml
index bc095af6..0a2c8fca 100644
--- a/driver/Commandline.ml
+++ b/driver/Commandline.ml
@@ -52,7 +52,7 @@ let rec find_action text = function
| (pat, act) :: rem ->
if match_pattern text pat then Some act else find_action text rem
-let parse_array spec usage argv first last =
+let parse_array spec argv first last =
(* Split the spec into Exact patterns (in a hashtable) and other patterns *)
let exact_cases = (Hashtbl.create 29 : (string, action) Hashtbl.t) in
let rec split_spec = function
@@ -69,10 +69,7 @@ let parse_array spec usage argv first last =
with Not_found -> find_action s inexact_cases in
match optact with
| None ->
- if s <> "-help" && s <> "--help"
- then eprintf "Unknown argument `%s'\n" s
- else printf "%s" usage;
- exit 2
+ eprintf "Unknown argument `%s'\n" s; exit 2
| Some(Set r) ->
r := true; parse (i+1)
| Some(Unset r) ->
@@ -101,5 +98,5 @@ let parse_array spec usage argv first last =
end
in parse first
-let parse_cmdline spec usage =
- parse_array spec usage Sys.argv 1 (Array.length Sys.argv - 1)
+let parse_cmdline spec =
+ parse_array spec Sys.argv 1 (Array.length Sys.argv - 1)