summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorragge <ragge>2009-08-15 08:24:22 +0000
committerragge <ragge>2009-08-15 08:24:22 +0000
commit741faae86a0292360ad24f8b160778b7097c6bff (patch)
tree1ef0f7738e18e94c7752bf58a825a353a2ba5b72
parent55519c3fb700154a19d78b51af77a2e097c83028 (diff)
Must expand identifier in #include directive. sloscan() don't do it and
yylex() will return a NUMBER. Fixes Jira#PCC-76 by Detlef Riekenberg.
-rw-r--r--cpp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cpp.c b/cpp.c
index 81fb1bd..92ac324 100644
--- a/cpp.c
+++ b/cpp.c
@@ -492,6 +492,7 @@ bad: error("bad line directive");
void
include()
{
+ struct symtab *nl;
struct incs *w;
usch *osp;
usch *fn, *safefn;
@@ -501,7 +502,17 @@ include()
return;
osp = stringbuf;
- if ((c = yylex()) != STRING && c != '<')
+ while ((c = sloscan()) == WSPACE)
+ ;
+ if (c == IDENT) {
+ /* sloscan() will not expand idents */
+ if ((nl = lookup((usch *)yytext, FIND)) == NULL)
+ goto bad;
+ unpstr(gotident(nl));
+ stringbuf = osp;
+ c = yylex();
+ }
+ if (c != STRING && c != '<')
goto bad;
if (c == '<') {