aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-07-08 19:53:16 +0000
committerTeresa Johnson <tejohnson@google.com>2015-07-08 19:53:16 +0000
commit0ad4f56c25eccbee4959773102e4b44f8be3a21b (patch)
tree1288f4bc9e61e77872ee4ae7177c69be50ddce23
parente4a612ebeb9ee8015f79a68d4a68e5d8bb9d8c00 (diff)
Avoid saving optimization pragma or function level attributes in the list
of command line options saved in the LIPO module info structure. 2015-07-08 Teresa Johnson <tejohnson@google.com> Google ref b/22326236 * 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. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9@225579 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-family/c-common.c2
-rw-r--r--gcc/opts-global.c18
-rw-r--r--gcc/opts.h3
-rw-r--r--gcc/toplev.c2
4 files changed, 16 insertions, 9 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 41f81221faa..ec1785d8f4d 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -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();
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index 425c3c0b28f..e83766034c0 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -299,7 +299,9 @@ lipo_save_cl_args (struct cl_decoded_option *decoded)
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, struct gcc_options *opts_set,
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, struct gcc_options *opts_set,
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 *handlers)
/* 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 gcc_options *opts_set,
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);
}
diff --git a/gcc/opts.h b/gcc/opts.h
index 790be537514..7caed791e10 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -344,7 +344,8 @@ extern void decode_options (struct gcc_options *opts,
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 *);
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 21e07bc8e9b..15f39c52dbf 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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 ();