From 927c92b47860da644a8747a6ff352a5df8ccc8ff Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 16 Feb 2008 13:44:52 -0800 Subject: [PATCH] BR 1582430: Allow numbers with leading + or - for %ifnum Allow numbers with a leading + or - to return true for %ifnum. --- preproc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/preproc.c b/preproc.c index bfacb87f..dd85ef0f 100644 --- a/preproc.c +++ b/preproc.c @@ -1584,13 +1584,17 @@ static bool if_condition(Token * tline, enum preproc_token ct) goto iftype; iftype: - tline = expand_smacro(tline); - t = tline; - while (tok_type_(t, TOK_WHITESPACE)) - t = t->next; - j = false; /* placate optimiser */ - if (t) - j = t->type == needtype; + tline = expand_smacro(tline); + t = tline; + + while (tok_type_(t, TOK_WHITESPACE) || + (needtype == TOK_NUMBER && + tok_type_(t, TOK_OTHER) && + (t->text[0] == '-' || t->text[0] == '+') && + !t->text[1])) + t = t->next; + + j = t && t->type == needtype; break; case PPC_IF: