aboutsummaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-07-08 10:15:31 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2016-07-08 10:15:31 +0200
commitea2d6b70ed06c60dba9ba81cf53883c85fb92068 (patch)
treed0ac3273943f124a59cd3f20aaa007589929a700 /driver
parentdb2445b3b745abd1a26f5a832a29ca269c725277 (diff)
downloadcompcert-ea2d6b70ed06c60dba9ba81cf53883c85fb92068.tar.gz
compcert-ea2d6b70ed06c60dba9ba81cf53883c85fb92068.zip
Added responsefile support for commandline.
Commandline can now be passed in a file specifed with @file on the Commandline. The quoting convention is similar to the one used by gcc, etc. Options are separated by whitespaces and options with whitespaecs need to be quoted. Bug 18303
Diffstat (limited to 'driver')
-rw-r--r--driver/Commandline.ml8
-rw-r--r--driver/Driver.ml1
2 files changed, 8 insertions, 1 deletions
diff --git a/driver/Commandline.ml b/driver/Commandline.ml
index 0a2c8fca..1981776e 100644
--- a/driver/Commandline.ml
+++ b/driver/Commandline.ml
@@ -16,6 +16,7 @@
(* Parsing of command-line flags and arguments *)
open Printf
+open Responsefile
type pattern =
| Exact of string
@@ -99,4 +100,9 @@ let parse_array spec argv first last =
in parse first
let parse_cmdline spec =
- parse_array spec Sys.argv 1 (Array.length Sys.argv - 1)
+ try
+ let argv = expand_responsefiles Sys.argv in
+ parse_array spec argv 1 (Array.length argv - 1)
+ with Arg.Bad s ->
+ eprintf "%s" s;
+ exit 2
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 7311215d..6d8cf9ac 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -334,6 +334,7 @@ General options:\n\
\ -v Print external commands before invoking them\n\
\ -timings Show the time spent in various compiler passes\n\
\ -version Print the version string and exit\n\
+\ @<file> Read command line options from <file>\n\
Interpreter mode:\n\
\ -interp Execute given .c files using the reference interpreter\n\
\ -quiet Suppress diagnostic messages for the interpreter\n\