[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/5] diagnostics: use grammar_file instead of current_file
From: |
Akim Demaille |
Subject: |
[PATCH 1/5] diagnostics: use grammar_file instead of current_file |
Date: |
Sat, 26 Oct 2019 16:44:39 +0200 |
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: {}
| <fixit-insert>%empty</fixit-insert>
/dev/stdout:1.4-5: <warning>warning:</warning> empty rule without %empty
[<warning>-Wempty-rule</warning>]
| <fixit-insert>%empty</fixit-insert>
-/dev/stdout: <warning>warning:</warning> fix-its can be applied. Rerun with
option '--update'. [<warning>-Wother</warning>]
+input.y: <warning>warning:</warning> fix-its can be applied. Rerun with
option '--update'. [<warning>-Wother</warning>]
]])
--
2.23.0