Fixed a problem with undefined identifiers in #if expressions: If the

identifier is not the last token on the line, the compiler will run into
an error.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3744 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2006-05-29 20:38:44 +00:00
parent b7255ed8fa
commit eb745b3d1b

View File

@@ -70,7 +70,7 @@ static GenDesc GenOASGN = { TOK_OR_ASSIGN, GEN_NOPUSH, g_or };
/*****************************************************************************/ /*****************************************************************************/
/* Helper functions */ /* Helper functions */
/*****************************************************************************/ /*****************************************************************************/
@@ -127,7 +127,7 @@ static Type* promoteint (Type* lhst, Type* rhst)
if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) {
return type_ulong; return type_ulong;
} else { } else {
return type_long; return type_long;
} }
} else { } else {
if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) {
@@ -328,7 +328,7 @@ static unsigned FunctionParamList (FuncDesc* Func)
--FrameParams; --FrameParams;
} }
/* Do we have more than one parameter in the frame? */ /* Do we have more than one parameter in the frame? */
if (FrameParams > 1) { if (FrameParams > 1) {
/* Okeydokey, setup the frame */ /* Okeydokey, setup the frame */
FrameOffs = StackPtr; FrameOffs = StackPtr;
@@ -371,7 +371,7 @@ static unsigned FunctionParamList (FuncDesc* Func)
if ((Func->Flags & FD_VARIADIC) == 0) { if ((Func->Flags & FD_VARIADIC) == 0) {
/* End of param list reached, no ellipsis */ /* End of param list reached, no ellipsis */
Error ("Too many arguments in function call"); Error ("Too many arguments in function call");
} }
/* Assume an ellipsis even in case of errors to avoid an error /* Assume an ellipsis even in case of errors to avoid an error
* message for each other argument. * message for each other argument.
*/ */
@@ -543,7 +543,7 @@ static void FunctionCall (ExprDesc* Expr)
RemoveCode (&Mark); RemoveCode (&Mark);
PtrOnStack = 0; PtrOnStack = 0;
} else { } else {
/* Load from the saved copy */ /* Load from the saved copy */
g_getlocal (CF_PTR, PtrOffs); g_getlocal (CF_PTR, PtrOffs);
} }
} else { } else {
@@ -627,6 +627,7 @@ static void Primary (ExprDesc* E)
* is an undefined macro and replace it by a constant value of zero. * is an undefined macro and replace it by a constant value of zero.
*/ */
if (Preprocessing && CurTok.Tok == TOK_IDENT) { if (Preprocessing && CurTok.Tok == TOK_IDENT) {
NextToken ();
ED_MakeConstAbsInt (E, 0); ED_MakeConstAbsInt (E, 0);
return; return;
} }
@@ -1216,7 +1217,7 @@ void Store (ExprDesc* Expr, const Type* StoreType)
case E_LOC_LITERAL: case E_LOC_LITERAL:
/* Static variable or literal in the literal pool */ /* Static variable or literal in the literal pool */
g_putstatic (Flags | CF_STATIC, Expr->Name, Expr->IVal); g_putstatic (Flags | CF_STATIC, Expr->Name, Expr->IVal);
break; break;
case E_LOC_REGISTER: case E_LOC_REGISTER:
/* Register variable */ /* Register variable */