summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSebastian Buchwald <Sebastian.Buchwald@kit.edu>2018-07-14 00:12:03 +0200
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>2018-07-14 00:12:03 +0200
commit713474341f1ea00bc12570b48134bde0b0df5a96 (patch)
tree9d4f950efeab7ad6ff5b3c05df5c66256c9fc716
parent62acdfe4b7897b2107246376667e09fc30f84a76 (diff)
Use real filename for #include "..."
The input name gets overwritten by #line directives.
-rw-r--r--src/parser/preprocessor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser/preprocessor.c b/src/parser/preprocessor.c
index b965dc8..4be4738 100644
--- a/src/parser/preprocessor.c
+++ b/src/parser/preprocessor.c
@@ -111,6 +111,7 @@ struct pp_input_t {
input_t *input;
pp_input_t *parent;
searchpath_entry_t *path;
+ char const *real_name;
position_t pos;
unsigned output_line;
};
@@ -231,6 +232,7 @@ static void switch_input(input_t *const decoder, char const *const input_name,
.bufend = end,
.bufpos = end,
.output_line = 0,
+ .real_name = input_name,
.pos = {
.input_name = input_name,
.lineno = 1,
@@ -3214,7 +3216,7 @@ static bool do_include(bool const bracket_include, bool const include_next,
entry = bracket_searchpath.first;
} else {
/* put dirname of current input on obstack */
- char const *const filename = input.pos.input_name;
+ char const *const filename = input.real_name;
char const *const last_slash = strrchr(filename, '/');
if (last_slash)
obstack_grow(&symbol_obstack, filename, last_slash - filename + 1);