aboutsummaryrefslogtreecommitdiff
path: root/gcc/cccp.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@cygnus.com>1998-07-13 17:20:29 +0000
committerNick Clifton <nickc@gcc.gnu.org>1998-07-13 17:20:29 +0000
commitb8468bc70accc102d7e1ba002704054393af5ff9 (patch)
treeb32468e6a5db793248f3d983d703512784c26fc1 /gcc/cccp.c
parentc6b0465b283d2acba778754d165025fe74410d8e (diff)
downloadgcc-b8468bc70accc102d7e1ba002704054393af5ff9.zip
gcc-b8468bc70accc102d7e1ba002704054393af5ff9.tar.gz
gcc-b8468bc70accc102d7e1ba002704054393af5ff9.tar.bz2
Add --help option.
From-SVN: r21109
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r--gcc/cccp.c80
1 files changed, 79 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index d717009..1bd7649 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