From 45a354d664b8862e3054a825d88af6d6ecf6a2c3 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Fri, 16 Nov 2012 20:02:27 +0100 Subject: [PATCH] Unary NOT in #if --- ftepp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ftepp.c b/ftepp.c index 6645166..a240643 100644 --- a/ftepp.c +++ b/ftepp.c @@ -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); -- 2.39.2