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>
This commit is contained in:
Cyrill Gorcunov 2011-10-02 01:06:29 +04:00
parent d6851d4d26
commit 4c6f82f78f

View File

@ -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: