summaryrefslogtreecommitdiff
path: root/preproc.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-10-02 01:06:29 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-10-02 01:08:02 +0400
commit4c6f82f78f1cbcff1318bfea642b89a96e75023a (patch)
treea2a521a079c8c80c472b95e1baca62c5a2b35393 /preproc.c
parentd6851d4d2654406abdc55a017961eb7b3c623500 (diff)
downloadnasm-4c6f82f78f1cbcff1318bfea642b89a96e75023a.tar.gz
nasm-4c6f82f78f1cbcff1318bfea642b89a96e75023a.tar.bz2
nasm-4c6f82f78f1cbcff1318bfea642b89a96e75023a.zip
BR3414012: Make %if[n]def to handle tail spaces
In case if there a trailing spaces after expansion %if[n]def might produce a false alarms on macro id being expected. Note it also makes the constructions like bare %ifdef %endif invalid, while before they were passed well without a notice. Reported-by: KO Myung-Hun Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'preproc.c')
-rw-r--r--preproc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/preproc.c b/preproc.c
index 63b0c61..6360dcc 100644
--- a/preproc.c
+++ b/preproc.c
@@ -1910,8 +1910,8 @@ static bool if_condition(Token * tline, enum preproc_token ct)
case PPC_IFDEF:
j = false; /* have we matched yet? */
- while (tline) {
- skip_white_(tline);
+ skip_white_(tline);
+ do {
if (!tline || (tline->type != TOK_ID &&
(tline->type != TOK_PREPROC_ID ||
tline->text[1] != '$'))) {
@@ -1922,7 +1922,8 @@ static bool if_condition(Token * tline, enum preproc_token ct)
if (smacro_defined(NULL, tline->text, 0, NULL, true))
j = true;
tline = tline->next;
- }
+ skip_white_(tline);
+ } while (tline);
break;
case PPC_IFENV: