mirror of
https://github.com/cc65/cc65.git
synced 2024-09-30 08:57:49 +00:00
Preprocess the remainder of the line in a #include preprocessor directive.
This allows use of macros in the file spec and is a requirement of the C standard. git-svn-id: svn://svn.cc65.org/cc65/trunk@3803 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
47860910e0
commit
e8b90752d9
@ -1044,20 +1044,6 @@ static int DoIf (int Skip)
|
|||||||
UseLineInfo (SavedNextTok.LI);
|
UseLineInfo (SavedNextTok.LI);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Remove the #if from the line */
|
|
||||||
SkipWhitespace ();
|
|
||||||
S = line;
|
|
||||||
while (CurC != '\0') {
|
|
||||||
*S++ = CurC;
|
|
||||||
NextChar ();
|
|
||||||
}
|
|
||||||
*S = '\0';
|
|
||||||
|
|
||||||
/* Start over parsing from line */
|
|
||||||
InitLine (line);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Switch into special preprocessing mode */
|
/* Switch into special preprocessing mode */
|
||||||
Preprocessing = 1;
|
Preprocessing = 1;
|
||||||
|
|
||||||
@ -1114,6 +1100,9 @@ static void DoInclude (void)
|
|||||||
StrBuf Filename = STATIC_STRBUF_INITIALIZER;
|
StrBuf Filename = STATIC_STRBUF_INITIALIZER;
|
||||||
|
|
||||||
|
|
||||||
|
/* Preprocess the remainder of the line */
|
||||||
|
PreprocessLine ();
|
||||||
|
|
||||||
/* Skip blanks */
|
/* Skip blanks */
|
||||||
SkipWhitespace ();
|
SkipWhitespace ();
|
||||||
|
|
||||||
@ -1146,15 +1135,14 @@ static void DoInclude (void)
|
|||||||
SB_Terminate (&Filename);
|
SB_Terminate (&Filename);
|
||||||
|
|
||||||
/* Check if we got a terminator */
|
/* Check if we got a terminator */
|
||||||
if (CurC != RTerm) {
|
if (CurC == RTerm) {
|
||||||
|
/* Open the include file */
|
||||||
|
OpenIncludeFile (SB_GetConstBuf (&Filename), DirSpec);
|
||||||
|
} else if (CurC == '\0') {
|
||||||
/* No terminator found */
|
/* No terminator found */
|
||||||
PPError ("Missing terminator or file name too long");
|
PPError ("#include expects \"FILENAME\" or <FILENAME>");
|
||||||
goto Done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the include file */
|
|
||||||
OpenIncludeFile (SB_GetConstBuf (&Filename), DirSpec);
|
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
/* Free the allocated filename data */
|
/* Free the allocated filename data */
|
||||||
DoneStrBuf (&Filename);
|
DoneStrBuf (&Filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user