From 36131c00d0e955d7d75cad7940804f26c9c3eeb6 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 14 Jul 2001 15:56:17 +0000 Subject: [PATCH] Work around a problem with the #if hack in the preprocessor git-svn-id: svn://svn.cc65.org/cc65/trunk@787 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/preproc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cc65/preproc.c b/src/cc65/preproc.c index 5c652aad4..1ea8cb81d 100644 --- a/src/cc65/preproc.c +++ b/src/cc65/preproc.c @@ -19,6 +19,7 @@ #include "ident.h" #include "incpath.h" #include "input.h" +#include "lineinfo.h" #include "macrotab.h" #include "scanner.h" #include "util.h" @@ -620,10 +621,20 @@ static int doiff (int skip) /* We're about to abuse the compiler expression parser to evaluate the * #if expression. Save the current tokens to come back here later. + * NOTE: Yes, this is a hack, but it saves a complete separate expression + * evaluation for the preprocessor. */ Token sv1 = CurTok; Token sv2 = NextTok; + /* Make sure the line infos for the tokens won't get removed */ + if (sv1.LI) { + UseLineInfo (sv1.LI); + } + if (sv2.LI) { + UseLineInfo (sv2.LI); + } + /* Remove the #if from the line and add two semicolons as sentinels */ SkipBlank (); S = line;