On Thu, May 02, 2019 at 12:51:05PM +0200, Martin Liška wrote:
> You are right, it's guarded in #ifdef ACCEL_COMPILER
> so I haven't seen the compilation error.
> 
> > 
> > Any reason why you've called print_help from finish_options rather than
> > decode_options after it calls finish_options?
> 
> Yes, I need that as I need option propagation, as described in:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89885#c0

Well, that doesn't answer the question.
I was wondering why you couldn't:

2019-05-02  Jakub Jelinek  <ja...@redhat.com>

        * opts.h (finish_options): Remove lang_mask argument.
        (print_help, help_option_argument): Declare.
        * opts.c (print_help): Remove forward declaration, no longer static.
        (finish_options): Remove lang_mask argument, don't call print_help
        here.
        * opts-global.c (decode_options): Adjust finish_option caller, call
        print_help here.

--- gcc/opts.h.jj       2019-05-02 12:18:35.558051021 +0200
+++ gcc/opts.h  2019-05-02 13:00:53.488347939 +0200
@@ -418,8 +418,8 @@ extern bool target_handle_option (struct
                                  void (*target_option_override_hook) (void));
 extern void finish_options (struct gcc_options *opts,
                            struct gcc_options *opts_set,
-                           location_t loc,
-                           unsigned int lang_mask);
+                           location_t loc);
+extern void print_help (struct gcc_options *opts, unsigned int lang_mask);
 extern void default_options_optimization (struct gcc_options *opts,
                                          struct gcc_options *opts_set,
                                          struct cl_decoded_option 
*decoded_options,
@@ -443,6 +443,8 @@ extern const struct sanitizer_opts_s
   bool can_recover;
 } sanitizer_opts[];
 
+extern const char *help_option_argument;
+
 extern void add_misspelling_candidates (auto_vec<char *> *candidates,
                                        const struct cl_option *option,
                                        const char *base_option);
--- gcc/opts.c.jj       2019-05-02 12:18:35.557051038 +0200
+++ gcc/opts.c  2019-05-02 13:00:34.058659611 +0200
@@ -858,15 +858,13 @@ control_options_for_live_patching (struc
 /* --help option argument if set.  */
 const char *help_option_argument = NULL;
 
-static void print_help (struct gcc_options *opts, unsigned int lang_mask);
-
 
 /* After all options at LOC have been read into OPTS and OPTS_SET,
    finalize settings of those options and diagnose incompatible
    combinations.  */
 void
 finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
-               location_t loc, unsigned int lang_mask)
+               location_t loc)
 {
   enum unwind_info_type ui_except;
 
@@ -1230,10 +1228,6 @@ finish_options (struct gcc_options *opts
                                         opts->x_flag_live_patching,
                                         loc);
     }
-
-  /* Print --help=* if used.  */
-  if (help_option_argument != NULL)
-    print_help (opts, lang_mask);
 }
 
 #define LEFT_COLUMN    27
@@ -2066,7 +2060,7 @@ check_alignment_argument (location_t loc
 
 /* Print help when OPT__help_ is set.  */
 
-static void
+void
 print_help (struct gcc_options *opts, unsigned int lang_mask)
 {
   const char *a = help_option_argument;
--- gcc/opts-global.c.jj        2019-05-02 12:18:36.673033137 +0200
+++ gcc/opts-global.c   2019-05-02 13:01:25.024842046 +0200
@@ -314,7 +314,11 @@ decode_options (struct gcc_options *opts
                        loc, lang_mask,
                        &handlers, dc);
 
-  finish_options (opts, opts_set, loc, lang_mask);
+  finish_options (opts, opts_set, loc);
+
+  /* Print --help=* if used.  */
+  if (help_option_argument != NULL)
+    print_help (opts, lang_mask);
 }
 
 /* Hold command-line options associated with stack limitation.  */

        Jakub

Reply via email to