Fixed bug in '#ifdef FALSE || 1 (garbage)
This commit is contained in:
parent
2cb19d3a30
commit
1de983200b
2 changed files with 9 additions and 4 deletions
|
@ -441,14 +441,16 @@ do_ifdef(how)
|
||||||
push_if();
|
push_if();
|
||||||
if (!(id = GetIdentifier(1)))
|
if (!(id = GetIdentifier(1)))
|
||||||
lexerror("illegal #ifdef construction");
|
lexerror("illegal #ifdef construction");
|
||||||
|
else if (SkipToNewLine())
|
||||||
|
if (!options['o'])
|
||||||
|
lexstrict("garbage following #%s <identifier>",
|
||||||
|
how ? "ifdef" : "ifndef");
|
||||||
|
|
||||||
/* The next test is a shorthand for:
|
/* The next test is a shorthand for:
|
||||||
(how && !id->id_macro) || (!how && id->id_macro)
|
(how && !id->id_macro) || (!how && id->id_macro)
|
||||||
*/
|
*/
|
||||||
if (how ^ (id && id->id_macro != 0))
|
if (how ^ (id && id->id_macro != 0))
|
||||||
skip_block(0);
|
skip_block(0);
|
||||||
else if (id)
|
|
||||||
SkipToNewLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* argidf != NULL when the undef came from a -U option */
|
/* argidf != NULL when the undef came from a -U option */
|
||||||
|
|
|
@ -448,14 +448,17 @@ do_ifdef(how)
|
||||||
id = findidf(str);
|
id = findidf(str);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
if (SkipToNewLine()) {
|
||||||
|
if (str && !options['o'])
|
||||||
|
strict("garbage following #%s <identifier>",
|
||||||
|
how ? "ifdef" : "ifndef");
|
||||||
|
}
|
||||||
|
|
||||||
/* The next test is a shorthand for:
|
/* The next test is a shorthand for:
|
||||||
(how && !id->id_macro) || (!how && id->id_macro)
|
(how && !id->id_macro) || (!how && id->id_macro)
|
||||||
*/
|
*/
|
||||||
if (how ^ (id && id->id_macro != 0))
|
if (how ^ (id && id->id_macro != 0))
|
||||||
skip_block(0);
|
skip_block(0);
|
||||||
else
|
|
||||||
SkipToNewLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* argstr != NULL when the undef came from a -U option */
|
/* argstr != NULL when the undef came from a -U option */
|
||||||
|
|
Loading…
Reference in a new issue