summaryrefslogtreecommitdiff
path: root/gcc/opts.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/opts.c
parent3ec8aef1d617142080d12a5498e10284e8221368 (diff)
downloadgcc-7abcc4972f22c3ede227e7053128c07cdf3a00e1.tar.gz
* 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/opts.c')
-rw-r--r--gcc/opts.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 44ed37bad4c..6e73561496d 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1442,3 +1442,37 @@ option_enabled (int opt_idx)
}
return -1;
}
+
+/* Fill STATE with the current state of option OPTION. Return true if
+ there is some state to store. */
+
+bool
+get_option_state (int option, struct cl_option_state *state)
+{
+ if (cl_options[option].flag_var == 0)
+ return false;
+
+ switch (cl_options[option].var_type)
+ {
+ case CLVC_BOOLEAN:
+ case CLVC_EQUAL:
+ state->data = cl_options[option].flag_var;
+ state->size = sizeof (int);
+ break;
+
+ case CLVC_BIT_CLEAR:
+ case CLVC_BIT_SET:
+ state->ch = option_enabled (option);
+ state->data = &state->ch;
+ state->size = 1;
+ break;
+
+ case CLVC_STRING:
+ state->data = *(const char **) cl_options[option].flag_var;
+ if (state->data == 0)
+ state->data = "";
+ state->size = strlen (state->data) + 1;
+ break;
+ }
+ return true;
+}