On Wed, Jul 14, 2021 at 10:21 AM Trevor Saunders <[email protected]> wrote:
>
> It appears that input_location was used here before the diagnostic's location
> was available, and never updated, when the other part of the header was added
> that uses it, so this makes it consistent.
>
> bootstrapped and regtested on x86_64-linux-gnu, ok?
OK.
Thanks,
Richard.
> Trev
>
> gcc/ChangeLog:
>
> * tree-diagnostic.c (diagnostic_report_current_function): Use the
> diagnostic's location, not input_location.
> ---
> gcc/tree-diagnostic.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
> index 8bb214b2cf5..705da94637d 100644
> --- a/gcc/tree-diagnostic.c
> +++ b/gcc/tree-diagnostic.c
> @@ -36,9 +36,9 @@ void
> diagnostic_report_current_function (diagnostic_context *context,
> diagnostic_info *diagnostic)
> {
> - diagnostic_report_current_module (context, diagnostic_location
> (diagnostic));
> - lang_hooks.print_error_function (context, LOCATION_FILE (input_location),
> - diagnostic);
> + location_t loc = diagnostic_location (diagnostic);
> + diagnostic_report_current_module (context, loc);
> + lang_hooks.print_error_function (context, LOCATION_FILE (loc), diagnostic);
> }
>
> static void
> --
> 2.20.1
>