diff options
author | Martin Liska <mliska@suse.cz> | 2021-12-10 09:58:52 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-12-28 11:05:28 +0100 |
commit | a187edd2b437fc9571d57f771a624963fcce08f8 (patch) | |
tree | 83c77c68b2e65bf43d69b0c319bef974636d14fe /gcc/opts.h | |
parent | 786973ce33dfbbd1fe64e16654dbe5881c9b1ebf (diff) | |
download | gcc-a187edd2b437fc9571d57f771a624963fcce08f8.zip gcc-a187edd2b437fc9571d57f771a624963fcce08f8.tar.gz gcc-a187edd2b437fc9571d57f771a624963fcce08f8.tar.bz2 |
driver: Improve option diagnostics [PR103465]
It happens that options are parsed and various diagnostics happen
in finish_options. That's a proper place as the function is also called
for optimize/target attributes (pragmas). However, it is possible that
target overwrites an option from command line and so the diagnostics
does not happen. That's fixed in the patch.
- options are parsed and finish_options is called:
if (opts->x_flag_unwind_tables
&& !targetm_common.unwind_tables_default
&& opts->x_flag_reorder_blocks_and_partition
&& (ui_except == UI_SJLJ || ui_except >= UI_TARGET))
{
if (opts_set->x_flag_reorder_blocks_and_partition)
inform (loc,
"%<-freorder-blocks-and-partition%> does not support "
"unwind info on this architecture");
opts->x_flag_reorder_blocks_and_partition = 0;
opts->x_flag_reorder_blocks = 1;
}
It's not triggered because of opts->x_flag_unwind_tables is false by default, but
the option is overwritten in target:
...
if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
{
if (opts->x_optimize >= 1)
SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer,
!USE_IX86_FRAME_POINTER);
if (opts->x_flag_asynchronous_unwind_tables
&& TARGET_64BIT_MS_ABI)
SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1);
...
PR driver/103465
gcc/ChangeLog:
* opts.c (finish_options): More part of diagnostics to ...
(diagnose_options): ... here. Call the function from both
finish_options and process_options.
* opts.h (diagnose_options): Declare.
* toplev.c (process_options): Call diagnose_options.
Diffstat (limited to 'gcc/opts.h')
-rw-r--r-- | gcc/opts.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -428,6 +428,8 @@ extern bool target_handle_option (struct gcc_options *opts, extern void finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc); +extern void diagnose_options (gcc_options *opts, gcc_options *opts_set, + location_t loc); extern void print_help (struct gcc_options *opts, unsigned int lang_mask, const char *help_option_argument); extern void default_options_optimization (struct gcc_options *opts, |