From b82ae19b91db32b12f0c0afe1a478f9d4caa6497 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 18 Jan 2017 12:11:46 +0100 Subject: Use quoted strings. Instead of escaping all newlines etc for the help options use quoted strings. Bug 19872 --- cparser/Cerrors.ml | 23 ++++---- debug/DebugInit.ml | 11 ++-- driver/Assembler.ml | 7 +-- driver/Driver.ml | 153 +++++++++++++++++++++++++++------------------------- driver/Frontend.ml | 66 ++++++++++++----------- driver/Linker.ml | 39 +++++++------- 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 Enable the specific \n\ -\ -Wno- Disable the specific \n\ -\ -Werror Make all warnings into errors\n\ -\ -Werror= Turn into an error\n\ -\ -Wno-error= Turn 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 Enable the specific + -Wno- Disable the specific + -Werror Make all warnings into errors + -Werror= Turn into an error + -Wno-error= Turn 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 Control generation of debugging information\n\ -\ (=0: none, =1: only-globals, =2: globals + locals \n\ -\ without locations, =3: full;)\n" +{|Debugging options: + -g Generate debugging information + -g Control generation of debugging information + (=0: none, =1: only-globals, =2: globals + locals + without locations, =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, Pass option to the assembler\n\ -\ -Xassembler Pass as an option to the assembler\n" +{|Assembling options: + -Wa, Pass option to the assembler + -Xassembler Pass 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] \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 .o\n\ -\ -E Preprocess only, send result to standard output\n\ -\ -S Compile to assembler only, save result in .s\n\ -\ -o Generate output in \n" ^ + {|Usage: ccomp [options] +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 .o + -E Preprocess only, send result to standard output + -S Compile to assembler only, save result in .s + -o Generate output in +|} ^ prepro_help ^ -"Language support options (use -fno- to turn off -f) :\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- to turn off -f) : + -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- to turn off -f)\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 Control constant propagation of floats\n\ -\ (=0: none, =1: limited, =2: full; default is full)\n\ -\ -fcse Perform common subexpression elimination [on]\n\ -\ -fredundancy Perform redundancy elimination [on]\n\ -Code generation options: (use -fno- to turn off -f)\n\ -\ -ffpu Use FP registers for some integer operations [on]\n\ -\ -fsmall-data Set maximal size for allocation in small data area\n\ -\ -fsmall-const Set maximal size for allocation in small constant area\n\ -\ -falign-functions Set alignment (in bytes) of function entry points\n\ -\ -falign-branch-targets Set alignment (in bytes) of branch targets\n\ -\ -falign-cond-branches Set alignment (in bytes) of conditional branches\n" ^ +{|Optimization options: (use -fno- to turn off -f) + -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 Control constant propagation of floats + (=0: none, =1: limited, =2: full; default is full) + -fcse Perform common subexpression elimination [on] + -fredundancy Perform redundancy elimination [on] +Code generation options: (use -fno- to turn off -f) + -ffpu Use FP registers for some integer operations [on] + -fsmall-data Set maximal size for allocation in small data area + -fsmall-const Set maximal size for allocation in small constant area + -falign-functions Set alignment (in bytes) of function entry points + -falign-branch-targets Set alignment (in bytes) of branch targets + -falign-cond-branches Set alignment (in bytes) of conditional branches|} ^ target_help ^ assembler_help ^ linker_help ^ -"Tracing options:\n\ -\ -dprepro Save C file after preprocessing in .i\n\ -\ -dparse Save C file after parsing and elaboration in .parsed.c\n\ -\ -dc Save generated Compcert C in .compcert.c\n\ -\ -dclight Save generated Clight in .light.c\n\ -\ -dcminor Save generated Cminor in .cm\n\ -\ -drtl Save RTL at various optimization points in .rtl.\n\ -\ -dltl Save LTL after register allocation in .ltl\n\ -\ -dmach Save generated Mach code in .mach\n\ -\ -dasm Save generated assembly in .s\n\ -\ -dall Save all generated intermediate files in .\n\ -\ -sdump Save info for post-linking validation in .json\n\ -\ -doptions Save the compiler configurations in .opt.json\n\ -General options:\n\ -\ -stdlib 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 Generate code for the given target\n\ -\ -conf Read configuration from file\n\ -\ @ Read command line options from \n" ^ +{|Tracing options: + -dprepro Save C file after preprocessing in .i + -dparse Save C file after parsing and elaboration in .parsed.c + -dc Save generated Compcert C in .compcert.c + -dclight Save generated Clight in .light.c + -dcminor Save generated Cminor in .cm + -drtl Save RTL at various optimization points in .rtl. + -dltl Save LTL after register allocation in .ltl + -dmach Save generated Mach code in .mach + -dasm Save generated assembly in .s + -dall Save all generated intermediate files in . + -sdump Save info for post-linking validation in .json + -doptions Save the compiler configurations in .opt.json +General options: + -stdlib 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 Generate code for the given target + -conf Read configuration from file + @ Read command line options from +|} ^ 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 Specifies 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 Change the target of the rule emitted by dependency\n\ -\ generation\n\ -\ -MQ Like -MT but quotes \n\ -\ -nostdinc Do not search the standard system directories for\n\ -\ header files\n\ -\ -imacros Like -include but throws output produced by\n\ -\ preprocessing of away\n\ -\ -idirafter Search for header files after all directories\n\ -\ specified with -I and the standard system directories\n\ -\ -isystem Search for header files after all directories\n\ -\ specified by -I but before the standard system directories\n\ -\ -iquote 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 Specifies 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 Change the target of the rule emitted by dependency + generation + -MQ Like -MT but quotes + -nostdinc Do not search the standard system directories for + header files + -imacros Like -include but throws output produced by + preprocessing of away + -idirafter Search for header files after all directories + specified with -I and the standard system directories + -isystem Search for header files after all directories + specified by -I but before the standard system directories + -iquote 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 Add to search path for #include files\n\ -\ -include Process as if #include \"\" appears at the first\n\ -\ line of the primary source file.\n\ -\ -D= Define preprocessor symbol\n\ -\ -U Undefine preprocessor symbol\n\ -\ -Wp, Pass option to the preprocessor\n\ -\ -Xpreprocessor Pass option to the preprocessor\n" +let prepro_help = {|Preprocessing options: + -I Add to search path for #include files + -include Process as if #include "" appears at the first + line of the primary source file. + -D= Define preprocessor symbol + -U Undefine preprocessor symbol + -Wp, Pass option to the preprocessor + -Xpreprocessor Pass option 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 Link library \n\ -\ -L Add to search path for libraries\n" ^ +{|Linking options: + -l Link library + -L Add 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 Use as linker command file\n\ -\ -Wl, Pass option to the linker\n\ -\ -WUl, Pass option to the gcc or dcc used for linking\n\ -\ -Xlinker Pass as an option to the linker\n\ -\ -u Pretend the symbol 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 Use as linker command file + -Wl, Pass option to the linker + -WUl, Pass option to the gcc or dcc used for linking + -Xlinker Pass as an option to the linker + -u Pretend the symbol is undefined to force linking of + library modules to define it. +|} let linker_actions = [ Prefix "-l", Self push_linker_arg; -- cgit