Unary NOT in #if

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-16 20:02:27 +01:00
parent bdd8b8275e
commit 45a354d664

10
ftepp.c
View file

@ -198,10 +198,18 @@ static bool ftepp_define(ftepp_t *ftepp)
static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
{
ppmacro *macro;
bool wasnot = false;
if (!ftepp_skipspace(ftepp))
return false;
while (ftepp->token == '!') {
wasnot = true;
ftepp_next(ftepp);
if (!ftepp_skipspace(ftepp))
return false;
}
switch (ftepp->token) {
case TOKEN_IDENT:
case TOKEN_TYPENAME:
@ -278,6 +286,8 @@ static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
ftepp_error(ftepp, "junk in #if");
return false;
}
if (wasnot)
*out = !*out;
ftepp->lex->flags.noops = false;
ftepp_next(ftepp);