diff options
author | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-07-13 17:20:29 +0000 |
---|---|---|
committer | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-07-13 17:20:29 +0000 |
commit | 8ace789a9566a4b55f8e13bb48f6a4771febbcbf (patch) | |
tree | b32468e6a5db793248f3d983d703512784c26fc1 /gcc/cccp.c | |
parent | 58dc6b1f419bc67d6f2fadf97b2a4ef9b4c5f845 (diff) | |
download | ppe42-gcc-8ace789a9566a4b55f8e13bb48f6a4771febbcbf.tar.gz ppe42-gcc-8ace789a9566a4b55f8e13bb48f6a4771febbcbf.zip |
Add --help option.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21109 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r-- | gcc/cccp.c | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c index d717009a35d..1bd7649ea7c 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -1047,6 +1047,7 @@ GENERIC_PTR xmalloc PROTO((size_t)); static GENERIC_PTR xrealloc PROTO((GENERIC_PTR, size_t)); static GENERIC_PTR xcalloc PROTO((size_t, size_t)); static char *savestring PROTO((char *)); +static void print_help PROTO((void)); /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME, retrying if necessary. If MAX_READ_LEN is defined, read at most @@ -1146,6 +1147,73 @@ eprint_string (string, length) } +static void +print_help () +{ + printf ("Usage: %s [switches] input output\n", progname); + printf ("Switches:\n"); + printf (" -include <file> Include the contents of <file> before other files\n"); + printf (" -imacros <file> Accept definition of marcos in <file>\n"); + printf (" -iprefix <path> Specify <path> as a prefix for next two options\n"); + printf (" -iwithprefix <dir> Add <dir> to the end of the system include paths\n"); + printf (" -iwithprefixbefore <dir> Add <dir> to the end of the main include paths\n"); + printf (" -isystem <dir> Add <dir> to the start of the system include paths\n"); + printf (" -idirafter <dir> Add <dir> to the end of the system include paths\n"); + printf (" -I <dir> Add <dir> to the end of the main include paths\n"); + printf (" -nostdinc Do not search the system include directories\n"); + printf (" -nostdinc++ Do not search the system include directories for C++\n"); + printf (" -o <file> Put output into <file>\n"); + printf (" -pedantic Issue all warnings demanded by strict ANSI C\n"); + printf (" -traditional Follow K&R pre-processor behaviour\n"); + printf (" -trigraphs Support ANSI C trigraphs\n"); + printf (" -lang-c Assume that the input sources are in C\n"); + printf (" -lang-c89 Assume that the input sources are in C89\n"); + printf (" -lang-c++ Assume that the input sources are in C++\n"); + printf (" -lang-objc Assume that the input sources are in ObjectiveC\n"); + printf (" -lang-objc++ Assume that the input sources are in ObjectiveC++\n"); + printf (" -lang-asm Assume that the input sources are in assembler\n"); + printf (" -lang-chill Assume that the input sources are in Chill\n"); + printf (" -+ Allow parsing of C++ style features\n"); + printf (" -w Inhibit warning messages\n"); + printf (" -Wtrigraphs Warn if trigraphs are encountered\n"); + printf (" -Wno-trigraphs Do not warn about trigraphs\n"); + printf (" -Wcomment{s} Warn if one comment starts inside another\n"); + printf (" -Wno-comment{s} Do not warn about comments\n"); + printf (" -Wtraditional Warn if a macro argument is/would be turned into\n"); + printf (" a string if -tradtional is specified\n"); + printf (" -Wno-traditional Do not warn about stringification\n"); + printf (" -Wundef Warn if an undefined macro is used by #if\n"); + printf (" -Wno-undef Do not warn about testing udefined macros\n"); + printf (" -Wimport Warn about the use of the #import directive\n"); + printf (" -Wno-import Do not warn about the use of #import\n"); + printf (" -Werror Treat all warnings as errors\n"); + printf (" -Wno-error Do not treat warnings as errors\n"); + printf (" -Wall Enable all preprocessor warnings\n"); + printf (" -M Generate make dependencies\n"); + printf (" -MM As -M, but ignore system header files\n"); + printf (" -MD As -M, but put output in a .d file\n"); + printf (" -MMD As -MD, but ignore system header files\n"); + printf (" -MG Treat missing header file as generated files\n"); + printf (" -g Include #define and #undef directives in the output\n"); + printf (" -D<macro> Define a <macro> with string '1' as its value\n"); + printf (" -D<macro>=<val> Define a <macro> with <val> as its value\n"); + printf (" -A<question> (<answer>) Assert the <answer> to <question>\n"); + printf (" -U<macro> Undefine <macro> \n"); + printf (" -u or -undef Do not predefine any macros\n"); + printf (" -v Display the version number\n"); + printf (" -H Print the name of header files as they are used\n"); + printf (" -C Do not discard comments\n"); + printf (" -dM Display a list of macro definitions active at end\n"); + printf (" -dD Preserve macro definitions in output\n"); + printf (" -dN As -dD except that only the names are preserved\n"); + printf (" -dI Include #include directives in the output\n"); + printf (" -ifoutput Describe skipped code blocks in output \n"); + printf (" -P Do not generate #line directives\n"); + printf (" -$ Do not include '$' in identifiers\n"); + printf (" -remap Remap file names when including files.\n"); + printf (" -h or --help Display this information\n"); +} + int main (argc, argv) int argc; @@ -1245,7 +1313,10 @@ main (argc, argv) for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { if (out_fname != NULL) - fatal ("Usage: %s [switches] input output", argv[0]); + { + print_help (); + fatal ("Too many arguments"); + } else if (in_fname != NULL) out_fname = argv[i]; else @@ -1525,6 +1596,13 @@ main (argc, argv) debug_output = 1; break; + case '-': + if (strcmp (argv[i], "--help") != 0) + return i; + print_help (); + exit (0); + break; + case 'v': fprintf (stderr, "GNU CPP version %s", version_string); #ifdef TARGET_VERSION |