summaryrefslogtreecommitdiffstats
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-01 06:55:47 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-01 06:55:47 +0000
commit7abcc4972f22c3ede227e7053128c07cdf3a00e1 (patch)
tree84536cfc7589dba0e2733eab222c518d135cbf94 /gcc/toplev.c
parent3ec8aef1d617142080d12a5498e10284e8221368 (diff)
downloadppe42-gcc-7abcc4972f22c3ede227e7053128c07cdf3a00e1.tar.gz
ppe42-gcc-7abcc4972f22c3ede227e7053128c07cdf3a00e1.zip
* opts.h (cl_option_state): New structure.
(get_option_state): Declare. * opts.c (get_option_state): New function. * toplev.c (option_affects_pch_p): New function. (default_get_pch_validity): Store the state of all options for which option_affects_pch_p returns true. (default_pch_valid_p): Check the state of those options here. Only check target_flags separately if targetm.check_pch_target_Flags is nonnull or if TARGET_SWITCHES is defined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100430 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 6cda6bba35b..550574fd154 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1434,6 +1434,21 @@ init_asm_output (const char *name)
}
}
+/* Return true if the state of option OPTION should be stored in PCH files
+ and checked by default_pch_valid_p. Store the option's current state
+ in STATE if so. */
+
+static inline bool
+option_affects_pch_p (int option, struct cl_option_state *state)
+{
+ if ((cl_options[option].flags & CL_TARGET) == 0)
+ return false;
+ if (cl_options[option].flag_var == &target_flags)
+ if (targetm.check_pch_target_flags)
+ return false;
+ return get_option_state (option, state);
+}
+
/* Default version of get_pch_validity.
By default, every flag difference is fatal; that will be mostly right for
most targets, but completely right for very few. */
@@ -1441,9 +1456,8 @@ init_asm_output (const char *name)
void *
default_get_pch_validity (size_t *len)
{
-#ifdef TARGET_OPTIONS
+ struct cl_option_state state;
size_t i;
-#endif
char *result, *r;
*len = sizeof (target_flags) + 2;
@@ -1455,6 +1469,9 @@ default_get_pch_validity (size_t *len)
*len += strlen (*target_options[i].variable);
}
#endif
+ for (i = 0; i < cl_options_count; i++)
+ if (option_affects_pch_p (i, &state))
+ *len += state.size;
result = r = xmalloc (*len);
r[0] = flag_pic;
@@ -1475,6 +1492,12 @@ default_get_pch_validity (size_t *len)
r += l;
}
#endif
+ for (i = 0; i < cl_options_count; i++)
+ if (option_affects_pch_p (i, &state))
+ {
+ memcpy (r, state.data, state.size);
+ r += state.size;
+ }
return result;
}
@@ -1484,6 +1507,7 @@ default_get_pch_validity (size_t *len)
const char *
default_pch_valid_p (const void *data_p, size_t len)
{
+ struct cl_option_state state;
const char *data = (const char *)data_p;
const char *flag_that_differs = NULL;
size_t i;
@@ -1504,9 +1528,9 @@ default_pch_valid_p (const void *data_p, size_t len)
if (r != NULL)
return r;
}
+#ifdef TARGET_SWITCHES
else if (tf != target_flags)
{
-#ifdef TARGET_SWITCHES
for (i = 0; i < ARRAY_SIZE (target_switches); i++)
{
int bits;
@@ -1520,16 +1544,9 @@ default_pch_valid_p (const void *data_p, size_t len)
goto make_message;
}
}
-#endif
- for (i = 0; i < cl_options_count; i++)
- if (cl_options[i].flag_var == &target_flags
- && (cl_options[i].var_value & (target_flags ^ tf)) != 0)
- {
- flag_that_differs = cl_options[i].opt_text + 2;
- goto make_message;
- }
gcc_unreachable ();
}
+#endif
data += sizeof (target_flags);
len -= sizeof (target_flags);
@@ -1552,6 +1569,18 @@ default_pch_valid_p (const void *data_p, size_t len)
}
#endif
+ for (i = 0; i < cl_options_count; i++)
+ if (option_affects_pch_p (i, &state))
+ {
+ if (memcmp (data, state.data, state.size) != 0)
+ {
+ flag_that_differs = cl_options[i].opt_text + 2;
+ goto make_message;
+ }
+ data += state.size;
+ len -= state.size;
+ }
+
return NULL;
make_message:
OpenPOWER on IntegriCloud