Resending in plain text mode.

On Wed, Jul 8, 2015 at 11:34 AM, Teresa Johnson <tejohn...@google.com> wrote:
> This patch avoids saving optimization pragma or function level attributes in
> the list of command line options saved in the LIPO module info structure.
> Passes regression and internal testing. Ok for google/4_9?
>
> Thanks,
> Teresa
>
> 2015-07-08  Teresa Johnson  <tejohn...@google.com>
>
>         * gcc/c-family/c-common.c (parse_optimize_options): New parameter.
>         * gcc/opts-global.c (read_cmdline_options): Use new parameter to
>         guard saving of LIPO command line options.
>         (decode_options): New parameter.
>         * gcc/opts.h (extern void decode_options): Ditto.
>         * gcc/toplev.c (toplev_main): Ditto.
>
> Index: gcc/c-family/c-common.c
> ===================================================================
> --- gcc/c-family/c-common.c     (revision 225521)
> +++ gcc/c-family/c-common.c     (working copy)
> @@ -9200,7 +9200,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, false);
>
>    targetm.override_options_after_change();
>
> Index: gcc/opts-global.c
> ===================================================================
> --- gcc/opts-global.c   (revision 225521)
> +++ gcc/opts-global.c   (working copy)
> @@ -299,7 +299,9 @@ lipo_save_cl_args (struct cl_decoded_option *decod
>     the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT
>     in OPTS and OPTS_SET and using DC for diagnostic state.  LANG_MASK
>     contains has a single bit set representing the current language.
> -   HANDLERS describes what functions to call for the options.  */
> +   HANDLERS describes what functions to call for the options.
> +   If COMMAND_LINE is true, this is being invoked for file level command
> +   line options, otherwise for an optimize pragma or function attribute.
> */
>
>  static void
>  read_cmdline_options (struct gcc_options *opts, struct gcc_options
> *opts_set,
> @@ -308,7 +310,8 @@ read_cmdline_options (struct gcc_options *opts, st
>                       location_t loc,
>                       unsigned int lang_mask,
>                       const struct cl_option_handlers *handlers,
> -                     diagnostic_context *dc)
> +                     diagnostic_context *dc,
> +                      bool command_line)
>  {
>    unsigned int i;
>    int force_multi_module = 0;
> @@ -341,7 +344,8 @@ read_cmdline_options (struct gcc_options *opts, st
>        read_cmdline_option (opts, opts_set,
>                            decoded_options + i, loc, lang_mask, handlers,
>                            dc);
> -      lipo_save_cl_args (decoded_options + i);
> +      if (command_line)
> +        lipo_save_cl_args (decoded_options + i);
>      }
>  }
>
> @@ -393,12 +397,14 @@ set_default_handlers (struct cl_option_handlers *h
>  /* Parse command line options and set default flag values.  Do minimal
>     options processing.  The decoded options are in *DECODED_OPTIONS
>     and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC;
> -   the options are located at LOC.  */
> +   the options are located at LOC.  If COMMAND_LINE is true, this is
> +   being invoked for file level command line options, otherwise for
> +   an optimize pragma or function attribute.  */
>  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, bool command_line)
>  {
>    struct cl_option_handlers handlers;
>
> @@ -415,7 +421,7 @@ decode_options (struct gcc_options *opts, struct g
>    read_cmdline_options (opts, opts_set,
>                         decoded_options, decoded_options_count,
>                         loc, lang_mask,
> -                       &handlers, dc);
> +                       &handlers, dc, command_line);
>
>    finish_options (opts, opts_set, loc);
>  }
> Index: gcc/opts.h
> ===================================================================
> --- gcc/opts.h  (revision 225521)
> +++ gcc/opts.h  (working copy)
> @@ -344,7 +344,8 @@ extern void decode_options (struct gcc_options *op
>                             struct cl_decoded_option *decoded_options,
>                             unsigned int decoded_options_count,
>                             location_t loc,
> -                           diagnostic_context *dc);
> +                           diagnostic_context *dc,
> +                            bool command_line);
>  extern int option_enabled (int opt_idx, void *opts);
>  extern bool get_option_state (struct gcc_options *, int,
>                               struct cl_option_state *);
> Index: gcc/toplev.c
> ===================================================================
> --- gcc/toplev.c        (revision 225521)
> +++ gcc/toplev.c        (working copy)
> @@ -2004,7 +2004,7 @@ 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, true);
>
>    handle_common_deferred_options ();
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413

Reply via email to