From cb7738452f613d5f10acc3e816c48be679c67087 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 2 Mar 2001 00:42:28 +0000 Subject: cpphash.h (struct cpp_reader): Add print_version field. * cpphash.h (struct cpp_reader): Add print_version field. * cppinit.c (cpp_handle_option): For -v, -version, and --version, just set print_version and other flags as appropriate. (cpp_post_options): Print version here if print_version is set. * toplev.c (exit_after_options): New flag. (independent_decode_option): Don't exit here; just set exit_after_options. (main): Exit after calling lang_hooks.post_options if exit_after_options is true. * cppinit.c (append_include_chain): Drop never-used case QUOTE. (merge_include_chains): Adjust comment to match code. From-SVN: r40171 --- gcc/toplev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gcc/toplev.c') diff --git a/gcc/toplev.c b/gcc/toplev.c index 68ba3ef..fdd8390 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -391,6 +391,9 @@ int errorcount = 0; int warningcount = 0; int sorrycount = 0; +/* Nonzero if we should exit after parsing options. */ +static int exit_after_options = 0; + /* The FUNCTION_DECL for the function currently being compiled, or 0 if between functions. */ tree current_function_decl; @@ -4368,19 +4371,19 @@ independent_decode_option (argc, argv) if (!strcmp (arg, "-help")) { display_help (); - exit (0); + exit_after_options = 1; } if (!strcmp (arg, "-target-help")) { display_target_options (); - exit (0); + exit_after_options = 1; } if (!strcmp (arg, "-version")) { print_version (stderr, ""); - exit (0); + exit_after_options = 1; } /* Handle '--param ='. */ @@ -4830,6 +4833,9 @@ main (argc, argv) if (lang_hooks.post_options) (*lang_hooks.post_options) (); + if (exit_after_options) + exit (0); + /* Reflect any language-specific diagnostic option setting. */ reshape_diagnostic_buffer (); -- cgit v1.1