On Wed, Oct 20, 2021 at 10:51 AM Martin Liška <mli...@suse.cz> wrote:
>
> On 10/19/21 12:53, Richard Biener wrote:
> > Meh ... :/
> >
> > Well, move the target override hook call down (try to shuffle things
> > so diagnostics happen after but
> > "inits" happen before).
>
> Not so easy. There are direct usages of the hooks
> (influences dwarf2out_as_loc_support and dwarf2out_as_locview_support)
>
>    if (!OPTION_SET_P (dwarf2out_as_loc_support))
>      dwarf2out_as_loc_support = dwarf2out_default_as_loc_support ();
>    if (!OPTION_SET_P (dwarf2out_as_locview_support))
>      dwarf2out_as_locview_support = dwarf2out_default_as_locview_support ();
>
>    if (!OPTION_SET_P (debug_variable_location_views))
>      {
>        debug_variable_location_views
>         = (flag_var_tracking
>            && debug_info_level >= DINFO_LEVEL_NORMAL
>            && dwarf_debuginfo_p ()
>            && !dwarf_strict
>            && dwarf2out_as_loc_support
>            && dwarf2out_as_locview_support);
>      }
>
> and then the warnings depend on debug_variable_location_views.
>
> I have another attempt which is about moving option detection of 
> debug_nonbind_markers_p
> to finish_options. That works fine, except one needs to mark the option as 
> PerFunction.
> That's because it depends on 'optimize' and that would trigger:
> 'global_options are modified in local context' verification error.

That looks like a sensible change anyway - options that depend on options that
are per function have to be per function as well.  It also depends on
flag_selective_scheduling.

But note the checks now happen before

  if (flag_syntax_only)
    {
      write_symbols = NO_DEBUG;
      profile_flag = 0;
    }

  if (flag_gtoggle)
    {
      if (debug_info_level == DINFO_LEVEL_NONE)
        {
          debug_info_level = DINFO_LEVEL_NORMAL;

          if (write_symbols == NO_DEBUG)
            write_symbols = PREFERRED_DEBUGGING_TYPE;
        }
      else
        debug_info_level = DINFO_LEVEL_NONE;
    }

which previously affected debug_nonbind_markers_p.  I think it makes
sense to move
the above to finish_options as well.  I suppose -help doesn't correctly dump
the -g enabled state for -gtoggle at the moment?

Richard.

>
> What do you think about the patch?
> Cheers,
> Martin

Reply via email to