From 4b4e532748af87a0ec4d5a7fa38bafce6b24fce7 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 22 Oct 2019 09:01:19 +0200 Subject: [PATCH] diagnostics: use grammar_file instead of current_file Currently there are two globals denoting the input file: grammar_file is the one from the command line, and current_file which might change because of #line. Use only the former. * src/complain.c (error_message): here. * tests/diagnostics.at: Adjust. --- src/complain.c | 2 +- tests/diagnostics.at | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/complain.c b/src/complain.c index ced908e3..87563d59 100644 --- a/src/complain.c +++ b/src/complain.c @@ -425,7 +425,7 @@ error_message (const location *loc, int *indent, warnings flags, if (loc) pos += location_print (*loc, stderr); else - pos += fprintf (stderr, "%s", current_file ? current_file : program_name); + pos += fprintf (stderr, "%s", grammar_file ? grammar_file : program_name); pos += fprintf (stderr, ": "); if (indent) diff --git a/tests/diagnostics.at b/tests/diagnostics.at index 96d7e224..70ba63fb 100644 --- a/tests/diagnostics.at +++ b/tests/diagnostics.at @@ -229,7 +229,7 @@ b: {} | %empty /dev/stdout:1.4-5: warning: empty rule without %empty [-Wempty-rule] | %empty -/dev/stdout: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] +input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] ]])