aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cparser/Cerrors.ml23
-rw-r--r--debug/DebugInit.ml11
-rw-r--r--driver/Assembler.ml7
-rwxr-xr-xdriver/Driver.ml153
-rw-r--r--driver/Frontend.ml66
-rw-r--r--driver/Linker.ml39
6 files changed, 156 insertions, 143 deletions
diff --git a/cparser/Cerrors.ml b/cparser/Cerrors.ml
index eec72023..f0b6bbbe 100644
--- a/cparser/Cerrors.ml
+++ b/cparser/Cerrors.ml
@@ -331,17 +331,18 @@ let warning_options =
Exact ("-Werror"), Unit werror;
Exact ("-Wall"), Unit wall;]
-let warning_help = "Diagnostic options:\n\
-\ -Wall Enable all warnings\n\
-\ -W<warning> Enable the specific <warning>\n\
-\ -Wno-<warning> Disable the specific <warning>\n\
-\ -Werror Make all warnings into errors\n\
-\ -Werror=<warning> Turn <warning> into an error\n\
-\ -Wno-error=<warning> Turn <warning> into a warning even if -Werror is\n\
- specified\n\
-\ -Wfatal-errors Turn all errors into fatal errors aborting the compilation\n\
-\ -fdiagnostics-color Turn on colored diagnostics\n\
-\ -fno-diagnostics-color Turn of colored diagnostics\n"
+let warning_help = {|Diagnostic options:
+ -Wall Enable all warnings
+ -W<warning> Enable the specific <warning>
+ -Wno-<warning> Disable the specific <warning>
+ -Werror Make all warnings into errors
+ -Werror=<warning> Turn <warning> into an error
+ -Wno-error=<warning> Turn <warning> into a warning even if -Werror is
+ specified
+ -Wfatal-errors Turn all errors into fatal errors aborting the compilation
+ -fdiagnostics-color Turn on colored diagnostics
+ -fno-diagnostics-color Turn of colored diagnostics
+|}
let raise_on_errors () =
if !num_errors > 0 then
diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml
index ed22f7c2..94a8cf02 100644
--- a/debug/DebugInit.ml
+++ b/debug/DebugInit.ml
@@ -71,11 +71,12 @@ let gnu_debugging_help =
" -gdwarf- Generate debug information in DWARF v2 or DWARF v3\n"
let debugging_help =
-"Debugging options:\n\
-\ -g Generate debugging information\n\
-\ -g<n> Control generation of debugging information\n\
-\ (<n>=0: none, <n>=1: only-globals, <n>=2: globals + locals \n\
-\ without locations, <n>=3: full;)\n"
+{|Debugging options:
+ -g Generate debugging information
+ -g<n> Control generation of debugging information
+ (<n>=0: none, <n>=1: only-globals, <n>=2: globals + locals
+ without locations, <n>=3: full;)
+|}
^ (if gnu_system then gnu_debugging_help else "")
let gnu_debugging_actions =
diff --git a/driver/Assembler.ml b/driver/Assembler.ml
index 52fb17d8..1d91ef50 100644
--- a/driver/Assembler.ml
+++ b/driver/Assembler.ml
@@ -42,6 +42,7 @@ let assembler_actions =
assembler_options := s::!assembler_options );]
let assembler_help =
-"Assembling options:\n\
-\ -Wa,<opt> Pass option <opt> to the assembler\n\
-\ -Xassembler <opt> Pass <opt> as an option to the assembler\n"
+{|Assembling options:
+ -Wa,<opt> Pass option <opt> to the assembler
+ -Xassembler <opt> Pass <opt> as an option to the assembler
+|}
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 8fc52e0c..d154c95b 100755
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -256,91 +256,96 @@ let version_string =
"The CompCert C verified compiler, version "^ Version.version ^ "\n"
let target_help = if Configuration.arch = "arm" then
-"Target processor options:\n\
-\ -mthumb Use Thumb2 instruction encoding\n\
-\ -marm Use classic ARM instruction encoding\n"
+{|Target processor options:
+ -mthumb Use Thumb2 instruction encoding
+ -marm Use classic ARM instruction encoding
+|}
else
""
let usage_string =
version_string ^
- "Usage: ccomp [options] <source files>\n\
-Recognized source files:\n\
-\ .c C source file\n\
-\ .i or .p C source file that should not be preprocessed\n\
-\ .cm Cminor source file\n\
-\ .s Assembly file\n\
-\ .S Assembly file that must be preprocessed\n\
-\ .o Object file\n\
-\ .a Library file\n\
-Processing options:\n\
-\ -c Compile to object file only (no linking), result in <file>.o\n\
-\ -E Preprocess only, send result to standard output\n\
-\ -S Compile to assembler only, save result in <file>.s\n\
-\ -o <file> Generate output in <file>\n" ^
+ {|Usage: ccomp [options] <source files>
+Recognized source files:
+ .c C source file
+ .i or .p C source file that should not be preprocessed
+ .cm Cminor source file
+ .s Assembly file
+ .S Assembly file that must be preprocessed
+ .o Object file
+ .a Library file
+Processing options:
+ -c Compile to object file only (no linking), result in <file>.o
+ -E Preprocess only, send result to standard output
+ -S Compile to assembler only, save result in <file>.s
+ -o <file> Generate output in <file>
+|} ^
prepro_help ^
-"Language support options (use -fno-<opt> to turn off -f<opt>) :\n\
-\ -fbitfields Emulate bit fields in structs [off]\n\
-\ -flongdouble Treat 'long double' as 'double' [off]\n\
-\ -fstruct-passing Support passing structs and unions by value as function\n\
-\ results or function arguments [off]\n\
-\ -fstruct-return Like -fstruct-passing (deprecated)\n\
-\ -fvararg-calls Support calls to variable-argument functions [on]\n\
-\ -funprototyped Support calls to old-style functions without prototypes [on]\n\
-\ -fpacked-structs Emulate packed structs [off]\n\
-\ -finline-asm Support inline 'asm' statements [off]\n\
-\ -fall Activate all language support options above\n\
-\ -fnone Turn off all language support options above\n" ^
+{|Language support options (use -fno-<opt> to turn off -f<opt>) :
+ -fbitfields Emulate bit fields in structs [off]
+ -flongdouble Treat 'long double' as 'double' [off]
+ -fstruct-passing Support passing structs and unions by value as function
+ results or function arguments [off]
+ -fstruct-return Like -fstruct-passing (deprecated)
+ -fvararg-calls Support calls to variable-argument functions [on]
+ -funprototyped Support calls to old-style functions without prototypes [on]
+ -fpacked-structs Emulate packed structs [off]
+ -finline-asm Support inline 'asm' statements [off]
+ -fall Activate all language support options above
+ -fnone Turn off all language support options above
+|}^
DebugInit.debugging_help ^
-"Optimization options: (use -fno-<opt> to turn off -f<opt>)\n\
-\ -O Optimize the compiled code [on by default]\n\
-\ -O0 Do not optimize the compiled code\n\
-\ -O1 -O2 -O3 Synonymous for -O\n\
-\ -Os Optimize for code size in preference to code speed\n\
-\ -ftailcalls Optimize function calls in tail position [on]\n\
-\ -fconst-prop Perform global constant propagation [on]\n\
-\ -ffloat-const-prop <n> Control constant propagation of floats\n\
-\ (<n>=0: none, <n>=1: limited, <n>=2: full; default is full)\n\
-\ -fcse Perform common subexpression elimination [on]\n\
-\ -fredundancy Perform redundancy elimination [on]\n\
-Code generation options: (use -fno-<opt> to turn off -f<opt>)\n\
-\ -ffpu Use FP registers for some integer operations [on]\n\
-\ -fsmall-data <n> Set maximal size <n> for allocation in small data area\n\
-\ -fsmall-const <n> Set maximal size <n> for allocation in small constant area\n\
-\ -falign-functions <n> Set alignment (in bytes) of function entry points\n\
-\ -falign-branch-targets <n> Set alignment (in bytes) of branch targets\n\
-\ -falign-cond-branches <n> Set alignment (in bytes) of conditional branches\n" ^
+{|Optimization options: (use -fno-<opt> to turn off -f<opt>)
+ -O Optimize the compiled code [on by default]
+ -O0 Do not optimize the compiled code
+ -O1 -O2 -O3 Synonymous for -O
+ -Os Optimize for code size in preference to code speed
+ -ftailcalls Optimize function calls in tail position [on]
+ -fconst-prop Perform global constant propagation [on]
+ -ffloat-const-prop <n> Control constant propagation of floats
+ (<n>=0: none, <n>=1: limited, <n>=2: full; default is full)
+ -fcse Perform common subexpression elimination [on]
+ -fredundancy Perform redundancy elimination [on]
+Code generation options: (use -fno-<opt> to turn off -f<opt>)
+ -ffpu Use FP registers for some integer operations [on]
+ -fsmall-data <n> Set maximal size <n> for allocation in small data area
+ -fsmall-const <n> Set maximal size <n> for allocation in small constant area
+ -falign-functions <n> Set alignment (in bytes) of function entry points
+ -falign-branch-targets <n> Set alignment (in bytes) of branch targets
+ -falign-cond-branches <n> Set alignment (in bytes) of conditional branches|} ^
target_help ^
assembler_help ^
linker_help ^
-"Tracing options:\n\
-\ -dprepro Save C file after preprocessing in <file>.i\n\
-\ -dparse Save C file after parsing and elaboration in <file>.parsed.c\n\
-\ -dc Save generated Compcert C in <file>.compcert.c\n\
-\ -dclight Save generated Clight in <file>.light.c\n\
-\ -dcminor Save generated Cminor in <file>.cm\n\
-\ -drtl Save RTL at various optimization points in <file>.rtl.<n>\n\
-\ -dltl Save LTL after register allocation in <file>.ltl\n\
-\ -dmach Save generated Mach code in <file>.mach\n\
-\ -dasm Save generated assembly in <file>.s\n\
-\ -dall Save all generated intermediate files in <file>.<ext>\n\
-\ -sdump Save info for post-linking validation in <file>.json\n\
-\ -doptions Save the compiler configurations in <file>.opt.json\n\
-General options:\n\
-\ -stdlib <dir> Set the path of the Compcert run-time library\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\
-\ -target <value> Generate code for the given target\n\
-\ -conf <file> Read configuration from file\n\
-\ @<file> Read command line options from <file>\n" ^
+{|Tracing options:
+ -dprepro Save C file after preprocessing in <file>.i
+ -dparse Save C file after parsing and elaboration in <file>.parsed.c
+ -dc Save generated Compcert C in <file>.compcert.c
+ -dclight Save generated Clight in <file>.light.c
+ -dcminor Save generated Cminor in <file>.cm
+ -drtl Save RTL at various optimization points in <file>.rtl.<n>
+ -dltl Save LTL after register allocation in <file>.ltl
+ -dmach Save generated Mach code in <file>.mach
+ -dasm Save generated assembly in <file>.s
+ -dall Save all generated intermediate files in <file>.<ext>
+ -sdump Save info for post-linking validation in <file>.json
+ -doptions Save the compiler configurations in <file>.opt.json
+General options:
+ -stdlib <dir> Set the path of the Compcert run-time library
+ -v Print external commands before invoking them
+ -timings Show the time spent in various compiler passes
+ -version Print the version string and exit
+ -target <value> Generate code for the given target
+ -conf <file> Read configuration from file
+ @<file> Read command line options from <file>
+|} ^
Cerrors.warning_help ^
-"Interpreter mode:\n\
-\ -interp Execute given .c files using the reference interpreter\n\
-\ -quiet Suppress diagnostic messages for the interpreter\n\
-\ -trace Have the interpreter produce a detailed trace of reductions\n\
-\ -random Randomize execution order\n\
-\ -all Simulate all possible execution orders\n"
+ {|Interpreter mode:
+ -interp Execute given .c files using the reference interpreter
+ -quiet Suppress diagnostic messages for the interpreter
+ -trace Have the interpreter produce a detailed trace of reductions
+ -random Randomize execution order
+ -all Simulate all possible execution orders
+|}
let print_usage_and_exit () =
printf "%s" usage_string; exit 0
diff --git a/driver/Frontend.ml b/driver/Frontend.ml
index 043d4e5a..41ca3bb8 100644
--- a/driver/Frontend.ml
+++ b/driver/Frontend.ml
@@ -128,37 +128,39 @@ let prepro_actions = [
@ (if gnu_system then gnu_prepro_actions else [])
let gnu_prepro_help =
-"\ -M Ouput a rule suitable for make describing the\n\
-\ dependencies of the main source file\n\
-\ -MM Like -M but do not mention system header files\n\
-\ -MF <file> Specifies file <file> as output file for -M or -MM\n\
-\ -MG Assumes missing header files are generated for -M\n\
-\ -MP Add a phony target for each dependency other than\n\
-\ the main file\n\
-\ -MT <target> Change the target of the rule emitted by dependency\n\
-\ generation\n\
-\ -MQ <target> Like -MT but quotes <target>\n\
-\ -nostdinc Do not search the standard system directories for\n\
-\ header files\n\
-\ -imacros <file> Like -include but throws output produced by\n\
-\ preprocessing of <file> away\n\
-\ -idirafter <dir> Search <dir> for header files after all directories\n\
-\ specified with -I and the standard system directories\n\
-\ -isystem <dir> Search <dir> for header files after all directories\n\
-\ specified by -I but before the standard system directories\n\
-\ -iquote <dir> Like -isystem but only for headers included with\n\
-\ quotes\n\
-\ -P Do not generate linemarkers\n\
-\ -C Do not discard comments\n\
-\ -CC Do not discard comments, including during macro\n\
-\ expansion\n"
+{| -M Ouput a rule suitable for make describing the
+ dependencies of the main source file
+ -MM Like -M but do not mention system header files
+ -MF <file> Specifies file <file> as output file for -M or -MM
+ -MG Assumes missing header files are generated for -M
+ -MP Add a phony target for each dependency other than
+ the main file
+ -MT <target> Change the target of the rule emitted by dependency
+ generation
+ -MQ <target> Like -MT but quotes <target>
+ -nostdinc Do not search the standard system directories for
+ header files
+ -imacros <file> Like -include but throws output produced by
+ preprocessing of <file> away
+ -idirafter <dir> Search <dir> for header files after all directories
+ specified with -I and the standard system directories
+ -isystem <dir> Search <dir> for header files after all directories
+ specified by -I but before the standard system directories
+ -iquote <dir> Like -isystem but only for headers included with
+ quotes
+ -P Do not generate linemarkers
+ -C Do not discard comments
+ -CC Do not discard comments, including during macro
+ expansion
+|}
-let prepro_help = "Preprocessing options:\n\
-\ -I<dir> Add <dir> to search path for #include files\n\
-\ -include <file> Process <file> as if #include \"<file>\" appears at the first\n\
-\ line of the primary source file.\n\
-\ -D<symb>=<val> Define preprocessor symbol\n\
-\ -U<symb> Undefine preprocessor symbol\n\
-\ -Wp,<opt> Pass option <opt> to the preprocessor\n\
-\ -Xpreprocessor <opt> Pass option <opt> to the preprocessor\n"
+let prepro_help = {|Preprocessing options:
+ -I<dir> Add <dir> to search path for #include files
+ -include <file> Process <file> as if #include "<file>" appears at the first
+ line of the primary source file.
+ -D<symb>=<val> Define preprocessor symbol
+ -U<symb> Undefine preprocessor symbol
+ -Wp,<opt> Pass option <opt> to the preprocessor
+ -Xpreprocessor <opt> Pass option <opt> to the preprocessor
+|}
^ (if gnu_system then gnu_prepro_help else "")
diff --git a/driver/Linker.ml b/driver/Linker.ml
index 2f767023..5e14cfd4 100644
--- a/driver/Linker.ml
+++ b/driver/Linker.ml
@@ -35,27 +35,30 @@ let linker exe_name files =
let gnu_linker_help =
-" -nostartfiles Do not use the standard system startup files when\n\
-\ linking\n\
-\ -nodefaultlibs Do not use the standard system libraries when\n\
-\ linking\n\
-\ -nostdlib Do not use the standard system startup files or\n\
-\ libraries when linking\n"
+{| -nostartfiles Do not use the standard system startup files when
+ linking
+ -nodefaultlibs Do not use the standard system libraries when
+ linking
+ -nostdlib Do not use the standard system startup files or
+ libraries when linking
+|}
let linker_help =
-"Linking options:\n\
-\ -l<lib> Link library <lib>\n\
-\ -L<dir> Add <dir> to search path for libraries\n" ^
+{|Linking options:
+ -l<lib> Link library <lib>
+ -L<dir> Add <dir> to search path for libraries
+|} ^
(if gnu_system then gnu_linker_help else "") ^
-" -s Remove all symbol table and relocation information from the\n\
-\ executable\n\
-\ -static Prevent linking with the shared libraries\n\
-\ -T <file> Use <file> as linker command file\n\
-\ -Wl,<opt> Pass option <opt> to the linker\n\
-\ -WUl,<opt> Pass option <opt> to the gcc or dcc used for linking\n\
-\ -Xlinker <opt> Pass <opt> as an option to the linker\n\
-\ -u <symb> Pretend the symbol <symb> is undefined to force linking of\n\
-\ library modules to define it.\n"
+{| -s Remove all symbol table and relocation information from the
+ executable
+ -static Prevent linking with the shared libraries
+ -T <file> Use <file> as linker command file
+ -Wl,<opt> Pass option <opt> to the linker
+ -WUl,<opt> Pass option <opt> to the gcc or dcc used for linking
+ -Xlinker <opt> Pass <opt> as an option to the linker
+ -u <symb> Pretend the symbol <symb> is undefined to force linking of
+ library modules to define it.
+|}
let linker_actions =
[ Prefix "-l", Self push_linker_arg;