]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r251400
authorMartin Liska <mliska@suse.cz>
Fri, 15 Sep 2017 09:19:36 +0000 (11:19 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 15 Sep 2017 09:19:36 +0000 (09:19 +0000)
2017-09-15  Martin Liska  <mliska@suse.cz>

Backport from mainline
2017-08-29  Martin Liska  <mliska@suse.cz>

PR other/39851
* gcc.c (driver_handle_option): Add new argument.
* opts-common.c (handle_option): Pass
target_option_override_hook.
* opts-global.c (lang_handle_option): Add new option.
(set_default_handlers):  Add new argument.
(decode_options): Likewise.
* opts.c (target_handle_option): Likewise.
(common_handle_option): Call target_option_override_hook.
* opts.h (struct cl_option_handler_func): Add hook for
target option override.
(struct cl_option_handlers): Likewise.
(set_default_handlers): Add new argument.
(decode_options): Likewise.
(common_handle_option): Likewise.
(target_handle_option): Likewise.
* toplev.c (toplev::main): Pass targetm.target_option.override
hook.
2017-09-15  Martin Liska  <mliska@suse.cz>

Backport from mainline
2017-08-29  Martin Liska  <mliska@suse.cz>

PR other/39851
* c-common.c (parse_optimize_options): Add argument to function
call.
* c-pragma.c (handle_pragma_diagnostic): Likewise.

From-SVN: r252797

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-pragma.c
gcc/gcc.c
gcc/opts-common.c
gcc/opts-global.c
gcc/opts.c
gcc/opts.h
gcc/toplev.c

index 5be04ffaec5fe7cda6e75a1ec1f0cb802c57dea1..04ce65b0ccdd3e4ebb5b69f018e33b1a217460f0 100644 (file)
@@ -1,3 +1,27 @@
+2017-09-15  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-08-29  Martin Liska  <mliska@suse.cz>
+
+       PR other/39851
+       * gcc.c (driver_handle_option): Add new argument.
+       * opts-common.c (handle_option): Pass
+       target_option_override_hook.
+       * opts-global.c (lang_handle_option): Add new option.
+       (set_default_handlers):  Add new argument.
+       (decode_options): Likewise.
+       * opts.c (target_handle_option): Likewise.
+       (common_handle_option): Call target_option_override_hook.
+       * opts.h (struct cl_option_handler_func): Add hook for
+       target option override.
+       (struct cl_option_handlers): Likewise.
+       (set_default_handlers): Add new argument.
+       (decode_options): Likewise.
+       (common_handle_option): Likewise.
+       (target_handle_option): Likewise.
+       * toplev.c (toplev::main): Pass targetm.target_option.override
+       hook.
+
 2017-09-15  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
index e4f7f99e2f1b9effc555656f7508d3f9e0101dc0..d1ce466a5448af63d2d2c9b207fd6bf447608970 100644 (file)
@@ -1,3 +1,13 @@
+2017-09-15  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-08-29  Martin Liska  <mliska@suse.cz>
+
+       PR other/39851
+       * c-common.c (parse_optimize_options): Add argument to function
+       call.
+       * c-pragma.c (handle_pragma_diagnostic): Likewise.
+
 2017-09-15  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
index e769053a3ba2744a06ec8dcc8d0431745a150029..b214f374601515813b1f5a0aa4fc6423c6d920e2 100644 (file)
@@ -9601,7 +9601,7 @@ parse_optimize_options (tree args, bool attr_p)
                                                &decoded_options_count);
   decode_options (&global_options, &global_options_set,
                  decoded_options, decoded_options_count,
-                 input_location, global_dc);
+                 input_location, global_dc, NULL);
 
   targetm.override_options_after_change();
 
index c73aa8221049b85949b0b62e88f58120e43aa39d..660f28673e65c490a04aed3c509119a63462b8ea 100644 (file)
@@ -813,7 +813,7 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
     }
 
   struct cl_option_handlers handlers;
-  set_default_handlers (&handlers);
+  set_default_handlers (&handlers, NULL);
   const char *arg = NULL;
   if (cl_options[option_index].flags & CL_JOINED)
     arg = option_string + 1 + cl_options[option_index].opt_len;
index 896d9af4acbc53b77f91735f302e4d452ca2d0f3..85ea19bd3a092d656beb7b36e4ec2deb29638db9 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3702,7 +3702,8 @@ driver_handle_option (struct gcc_options *opts,
                      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
                      location_t loc,
                      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
-                     diagnostic_context *dc)
+                     diagnostic_context *dc,
+                     void (*) (void))
 {
   size_t opt_index = decoded->opt_index;
   const char *arg = decoded->arg;
index 900c580019e7dc77a35a546d755c8e79ab6571ef..0d7f93d554504c984880430c055e05ae21c4574c 100644 (file)
@@ -986,7 +986,8 @@ handle_option (struct gcc_options *opts,
       {
        if (!handlers->handlers[i].handler (opts, opts_set, decoded,
                                            lang_mask, kind, loc,
-                                           handlers, dc))
+                                           handlers, dc,
+                                           handlers->target_option_override_hook))
          return false;
       }
   
index b7e52323a21fb0e84c54bb52cc87587788c8fba4..23dd7fb5579805194ce09c61f16642b5479cf1ae 100644 (file)
@@ -167,7 +167,8 @@ lang_handle_option (struct gcc_options *opts,
                    unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
                    location_t loc,
                    const struct cl_option_handlers *handlers,
-                   diagnostic_context *dc)
+                   diagnostic_context *dc,
+                   void (*) (void))
 {
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set == &global_options_set);
@@ -267,10 +268,12 @@ decode_cmdline_options_to_array_default_mask (unsigned int argc,
 /* Set *HANDLERS to the default set of option handlers for use in the
    compilers proper (not the driver).  */
 void
-set_default_handlers (struct cl_option_handlers *handlers)
+set_default_handlers (struct cl_option_handlers *handlers,
+                     void (*target_option_override_hook) (void))
 {
   handlers->unknown_option_callback = unknown_option_callback;
   handlers->wrong_lang_callback = complain_wrong_lang;
+  handlers->target_option_override_hook = target_option_override_hook;
   handlers->num_handlers = 3;
   handlers->handlers[0].handler = lang_handle_option;
   handlers->handlers[0].mask = initial_lang_mask;
@@ -288,7 +291,8 @@ void
 decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
                struct cl_decoded_option *decoded_options,
                unsigned int decoded_options_count,
-               location_t loc, diagnostic_context *dc)
+               location_t loc, diagnostic_context *dc,
+               void (*target_option_override_hook) (void))
 {
   struct cl_option_handlers handlers;
 
@@ -296,7 +300,7 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
 
   lang_mask = initial_lang_mask;
 
-  set_default_handlers (&handlers);
+  set_default_handlers (&handlers, target_option_override_hook);
 
   default_options_optimization (opts, opts_set,
                                decoded_options, decoded_options_count,
index 0f9431a0b3231e57605a1af44774bc1e6980bfc3..8f9862db57c24b1a07bb780014a67152b7489f22 100644 (file)
@@ -216,7 +216,7 @@ target_handle_option (struct gcc_options *opts,
                      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
                      location_t loc,
                      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
-                     diagnostic_context *dc)
+                     diagnostic_context *dc, void (*) (void))
 {
   gcc_assert (dc == global_dc);
   gcc_assert (kind == DK_UNSPECIFIED);
@@ -1543,7 +1543,8 @@ common_handle_option (struct gcc_options *opts,
                      unsigned int lang_mask, int kind ATTRIBUTE_UNUSED,
                      location_t loc,
                      const struct cl_option_handlers *handlers,
-                     diagnostic_context *dc)
+                     diagnostic_context *dc,
+                     void (*target_option_override_hook) (void))
 {
   size_t scode = decoded->opt_index;
   const char *arg = decoded->arg;
@@ -1570,6 +1571,7 @@ common_handle_option (struct gcc_options *opts,
        undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings)
                      ? 0
                      : CL_UNDOCUMENTED);
+       target_option_override_hook ();
        /* First display any single language specific options.  */
        for (i = 0; i < cl_lang_count; i++)
          print_specific_help
@@ -1589,6 +1591,7 @@ common_handle_option (struct gcc_options *opts,
       if (lang_mask == CL_DRIVER)
        break;
 
+      target_option_override_hook ();
       print_specific_help (CL_TARGET, CL_UNDOCUMENTED, 0, opts, lang_mask);
       opts->x_exit_after_options = true;
       break;
@@ -1710,8 +1713,11 @@ common_handle_option (struct gcc_options *opts,
          }
 
        if (include_flags)
-         print_specific_help (include_flags, exclude_flags, 0, opts,
-                              lang_mask);
+         {
+           target_option_override_hook ();
+           print_specific_help (include_flags, exclude_flags, 0, opts,
+                                lang_mask);
+         }
        opts->x_exit_after_options = true;
        break;
       }
index 25d32c1ad49fff9c5beb073be32da80328c782a2..52887b6a32c7424359076ba57f7d4e983dca5d27 100644 (file)
@@ -267,7 +267,8 @@ struct cl_option_handler_func
                   const struct cl_decoded_option *decoded,
                   unsigned int lang_mask, int kind, location_t loc,
                   const struct cl_option_handlers *handlers,
-                  diagnostic_context *dc);
+                  diagnostic_context *dc,
+                  void (*target_option_override_hook) (void));
 
   /* The mask that must have some bit in common with the flags for the
      option for this particular handler to be used.  */
@@ -289,6 +290,9 @@ struct cl_option_handlers
   void (*wrong_lang_callback) (const struct cl_decoded_option *decoded,
                               unsigned int lang_mask);
 
+  /* Target option override hook.  */
+  void (*target_option_override_hook) (void);
+
   /* The number of individual handlers.  */
   size_t num_handlers;
 
@@ -333,13 +337,15 @@ extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
                                                          const char **argv, 
                                                          struct cl_decoded_option **decoded_options,
                                                          unsigned int *decoded_options_count);
-extern void set_default_handlers (struct cl_option_handlers *handlers);
+extern void set_default_handlers (struct cl_option_handlers *handlers,
+                                 void (*target_option_override_hook) (void));
 extern void decode_options (struct gcc_options *opts,
                            struct gcc_options *opts_set,
                            struct cl_decoded_option *decoded_options,
                            unsigned int decoded_options_count,
                            location_t loc,
-                           diagnostic_context *dc);
+                           diagnostic_context *dc,
+                           void (*target_option_override_hook) (void));
 extern int option_enabled (int opt_idx, void *opts);
 extern bool get_option_state (struct gcc_options *, int,
                              struct cl_option_state *);
@@ -384,14 +390,16 @@ extern bool common_handle_option (struct gcc_options *opts,
                                  unsigned int lang_mask, int kind,
                                  location_t loc,
                                  const struct cl_option_handlers *handlers,
-                                 diagnostic_context *dc);
+                                 diagnostic_context *dc,
+                                 void (*target_option_override_hook) (void));
 extern bool target_handle_option (struct gcc_options *opts,
                                  struct gcc_options *opts_set,
                                  const struct cl_decoded_option *decoded,
                                  unsigned int lang_mask, int kind,
                                  location_t loc,
                                  const struct cl_option_handlers *handlers,
-                                 diagnostic_context *dc);
+                                 diagnostic_context *dc,
+                                 void (*target_option_override_hook) (void));
 extern void finish_options (struct gcc_options *opts,
                            struct gcc_options *opts_set,
                            location_t loc);
index 3d4137b7c7b91490e63c3e0620058bd6f65b47c9..d6f6c74ffbc44576fed2693978739314f1b66369 100644 (file)
@@ -2100,7 +2100,8 @@ toplev::main (int argc, char **argv)
      enough to default flags appropriately.  */
   decode_options (&global_options, &global_options_set,
                  save_decoded_options, save_decoded_options_count,
-                 UNKNOWN_LOCATION, global_dc);
+                 UNKNOWN_LOCATION, global_dc,
+                 targetm.target_option.override);
 
   handle_common_deferred_options ();