summaryrefslogtreecommitdiffstats
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-05 23:41:00 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-05 23:41:00 +0000
commit1353d9f74da1d0abfcb3c790352dde5cf5f31a01 (patch)
treed4a4a93914e1c41a8f3f7e9b66d5a2e9ca0a0bac /gcc/cppinit.c
parentc677d652f0a03564b77399d84deb558a3c519656 (diff)
downloadppe42-gcc-1353d9f74da1d0abfcb3c790352dde5cf5f31a01.tar.gz
ppe42-gcc-1353d9f74da1d0abfcb3c790352dde5cf5f31a01.zip
* cpplib.h (struct cpp_reader): Add help_only field.
* cppinit.c (COMMAND_LINE_OPTIONS): Add OPT_version. (cpp_handle_option): Set pfile->help_only if we see -h, --help, -target-help, or --version. Print version string but do not set help_only if we see -v or -version. Make text printed by -v match that printed by (-)-version. * cppmain.c (main): Exit after option parsing if pfile->help_only is true. * toplev.c (independent_decode_option): Call print_version, then exit, if we see --version (but not -version). (print_version): Split lengthy message into two lines. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38733 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 310fc04edba..7454b6f6733 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -1130,6 +1130,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("std=iso9899:199x", 0, OPT_std_iso9899_199x) \
DEF_OPT("trigraphs", 0, OPT_trigraphs) \
DEF_OPT("v", 0, OPT_v) \
+ DEF_OPT("version", 0, OPT_version) \
DEF_OPT("w", 0, OPT_w)
#define DEF_OPT(text, msg, code) code,
@@ -1322,16 +1323,32 @@ cpp_handle_option (pfile, argc, argv)
case OPT_h:
case OPT__help:
print_help ();
- exit (0); /* XXX */
+ pfile->help_only = 1;
break;
case OPT_target__help:
- /* Print if any target specific options. */
- exit (0);
+ /* Print if any target specific options. cpplib has none, but
+ make sure help_only gets set. */
+ pfile->help_only = 1;
break;
+
+ /* --version inhibits compilation, -version doesn't. -v means
+ verbose and -version. Historical reasons, don't ask. */
case OPT__version:
- fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
- exit (0); /* XXX */
+ pfile->help_only = 1;
+ goto version;
+ case OPT_v:
+ CPP_OPTION (pfile, verbose) = 1;
+ goto version;
+
+ case OPT_version:
+ version:
+ fprintf (stderr, _("GNU CPP version %s (cpplib)"), version_string);
+#ifdef TARGET_VERSION
+ TARGET_VERSION;
+#endif
+ fputc ('\n', stderr);
break;
+
case OPT_C:
CPP_OPTION (pfile, discard_comments) = 0;
break;
@@ -1425,14 +1442,6 @@ cpp_handle_option (pfile, argc, argv)
if (!strcmp (CPP_OPTION (pfile, out_fname), "-"))
CPP_OPTION (pfile, out_fname) = "";
break;
- case OPT_v:
- fprintf (stderr, _("GNU CPP version %s (cpplib)"), version_string);
-#ifdef TARGET_VERSION
- TARGET_VERSION;
-#endif
- fputc ('\n', stderr);
- CPP_OPTION (pfile, verbose) = 1;
- break;
case OPT_stdin_stdout:
/* JF handle '-' as file name meaning stdin or stdout. */
if (CPP_OPTION (pfile, in_fname) == NULL)
OpenPOWER on IntegriCloud