1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 22:29:35 +00:00

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
This commit is contained in:
cuz 2001-07-14 15:56:17 +00:00
parent 6dcb3b662e
commit 36131c00d0

View File

@ -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;