diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2005-06-01 06:55:47 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2005-06-01 06:55:47 +0000 |
commit | 5c60a0172d9cce62e61afd5d851106775a1a48e6 (patch) | |
tree | 84536cfc7589dba0e2733eab222c518d135cbf94 /gcc/opts.c | |
parent | b76f4c1c79e7a5e317d505ac09de3614c8179857 (diff) | |
download | gcc-5c60a0172d9cce62e61afd5d851106775a1a48e6.zip gcc-5c60a0172d9cce62e61afd5d851106775a1a48e6.tar.gz gcc-5c60a0172d9cce62e61afd5d851106775a1a48e6.tar.bz2 |
opts.h (cl_option_state): New structure.
* 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.
From-SVN: r100430
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -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; +} |