Don't crash when using `define value for an `include argument.
When pushing the current file path we need to get past any `define
expansions that have been pushed onto the stack to find the real
file path.
This patch is partially based on a patch submitted by Steve Tell.
(cherry picked from commit b2d479eaf6)
This commit is contained in:
parent
e11f4cf69e
commit
6d56e356b4
|
|
@ -1483,9 +1483,16 @@ static void do_include()
|
|||
unsigned idx, start = 1;
|
||||
char path[4096];
|
||||
char *cp;
|
||||
struct include_stack_t* isp;
|
||||
|
||||
/* Add the current path to the start of the include_dir list. */
|
||||
strcpy(path, istack->path);
|
||||
isp = istack;
|
||||
while(isp && (isp->path == NULL))
|
||||
isp = isp->next;
|
||||
|
||||
assert(isp);
|
||||
|
||||
strcpy(path, isp->path);
|
||||
cp = strrchr(path, '/');
|
||||
|
||||
/* I may need the relative path for a planned warning even when
|
||||
|
|
@ -1508,7 +1515,8 @@ static void do_include()
|
|||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s:%u: Include file %s not found\n", istack->path, istack->lineno, standby->path);
|
||||
emit_pathline(istack);
|
||||
fprintf(stderr, "Include file %s not found\n", standby->path);
|
||||
exit(1);
|
||||
|
||||
code_that_switches_buffers:
|
||||
|
|
|
|||
Loading…
Reference in New Issue