Fix bug where a preprocessing directive could be mis-evaluated if it occurred immediately after a use of a function-like macro.

This occurred because the code to handle the function-like macro use would read the following token, which could prompt processing of the following preprocessing directive in an inappropriate context.

The following example illustrates the problem (the error message would be printed):

#define A()
#define FOO 1
A()
#if !FOO
# error "shouldn't get here"
#endif
This commit is contained in:
Stephen Heumann 2015-12-29 23:18:20 -06:00
parent 97cca84713
commit 2d6ae52d32

View File

@ -1297,18 +1297,17 @@ if macro^.parameters >= 0 then begin {find the values of the parameters}
until done;
if paramCount <> macro^.parameters then
Error(14);
if token.kind = rparench then {insist on a closing ')'}
begin
if not gettingFileName then
NextToken
end {if}
else
if token.kind <> rparench then begin {insist on a closing ')'}
if not gettingFileName then {put back the source stream token}
PutBackToken(token, true);
Error(12);
end;
end {if}
else
else begin
Error(13);
if not gettingFileName then {put back the source stream token}
PutBackToken(token, true);
if not gettingFileName then {put back the source stream token}
PutBackToken(token, true);
end; {else}
end; {if}
if macro^.readOnly then begin {handle special macros}
case macro^.algorithm of