aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.stanford.edu>2001-01-05 23:41:00 +0000
committerZack Weinberg <zack@gcc.gnu.org>2001-01-05 23:41:00 +0000
commitf4cdc368349bc046cd0874408bad7fc6f2104a3a (patch)
treed4a4a93914e1c41a8f3f7e9b66d5a2e9ca0a0bac /gcc/cppmain.c
parent3326b760b32854ee0f513b44d0be770fad8f49e6 (diff)
downloadgcc-f4cdc368349bc046cd0874408bad7fc6f2104a3a.zip
gcc-f4cdc368349bc046cd0874408bad7fc6f2104a3a.tar.gz
gcc-f4cdc368349bc046cd0874408bad7fc6f2104a3a.tar.bz2
cpplib.h (struct cpp_reader): Add help_only field.
* 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. From-SVN: r38733
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index ace260c..6fa158d 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -82,6 +82,13 @@ main (argc, argv)
if (CPP_FATAL_ERRORS (pfile))
return (FATAL_EXIT_CODE);
+ /* If cpp_handle_options saw --help or --version on the command
+ line, it will have set pfile->help_only to indicate this. Exit
+ successfully. [The library does not exit itself, because
+ e.g. cc1 needs to print its own --help message at this point.] */
+ if (pfile->help_only)
+ return (SUCCESS_EXIT_CODE);
+
/* Open the output now. We must do so even if no_output is on,
because there may be other output than from the actual
preprocessing (e.g. from -dM). */