From: cuz Date: Fri, 31 Aug 2007 16:02:03 +0000 (+0000) Subject: Preprocess the remainder of the line in a #include preprocessor directive. X-Git-Tag: V2.12.0~54 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e8b90752d9c4d88311dbcd8e74bc4f46028ef852;p=cc65 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 --- diff --git a/src/cc65/preproc.c b/src/cc65/preproc.c index b7edc05de..f45bcdedd 100644 --- a/src/cc65/preproc.c +++ b/src/cc65/preproc.c @@ -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 "); } - /* Open the include file */ - OpenIncludeFile (SB_GetConstBuf (&Filename), DirSpec); - Done: /* Free the allocated filename data */ DoneStrBuf (&Filename);