1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-14 05:05:45 +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:
cuz 2007-08-31 16:02:03 +00:00
parent 47860910e0
commit e8b90752d9

View File

@ -1044,20 +1044,6 @@ static int DoIf (int Skip)
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 */
Preprocessing = 1;
@ -1114,6 +1100,9 @@ static void DoInclude (void)
StrBuf Filename = STATIC_STRBUF_INITIALIZER;
/* Preprocess the remainder of the line */
PreprocessLine ();
/* Skip blanks */
SkipWhitespace ();
@ -1146,15 +1135,14 @@ static void DoInclude (void)
SB_Terminate (&Filename);
/* 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 */
PPError ("Missing terminator or file name too long");
goto Done;
PPError ("#include expects \"FILENAME\" or <FILENAME>");
}
/* Open the include file */
OpenIncludeFile (SB_GetConstBuf (&Filename), DirSpec);
Done:
/* Free the allocated filename data */
DoneStrBuf (&Filename);