mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 21:00:28 +02:00
* skip <type>(<expr>) in the cond. expression parser if eval is false
git-svn-id: trunk@29116 -
This commit is contained in:
parent
66d735c536
commit
b7a1418065
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10307,6 +10307,7 @@ tests/tbs/tb0604.pp svneol=native#text/pascal
|
|||||||
tests/tbs/tb0605.pp svneol=native#text/pascal
|
tests/tbs/tb0605.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0606.pp svneol=native#text/pascal
|
tests/tbs/tb0606.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0607.pp svneol=native#text/plain
|
tests/tbs/tb0607.pp svneol=native#text/plain
|
||||||
|
tests/tbs/tb0608.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb205.pp svneol=native#text/plain
|
tests/tbs/tb205.pp svneol=native#text/plain
|
||||||
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
||||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||||
|
@ -1912,6 +1912,7 @@ type
|
|||||||
{ first look for a macros/int/float }
|
{ first look for a macros/int/float }
|
||||||
result:=preproc_substitutedtoken(storedpattern,eval);
|
result:=preproc_substitutedtoken(storedpattern,eval);
|
||||||
if eval and (result.consttyp=conststring) then
|
if eval and (result.consttyp=conststring) then
|
||||||
|
begin
|
||||||
if searchsym(storedpattern,srsym,srsymtable) then
|
if searchsym(storedpattern,srsym,srsymtable) then
|
||||||
begin
|
begin
|
||||||
try_consume_nestedsym(srsym,srsymtable);
|
try_consume_nestedsym(srsym,srsymtable);
|
||||||
@ -1928,6 +1929,22 @@ type
|
|||||||
result:=texprvalue.create_int(tenumsym(srsym).value);
|
result:=texprvalue.create_int(tenumsym(srsym).value);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{ skip id(<expr>) if expression must not be evaluated }
|
||||||
|
else if not(eval) and (result.consttyp=conststring) then
|
||||||
|
begin
|
||||||
|
if current_scanner.preproc_token =_LKLAMMER then
|
||||||
|
begin
|
||||||
|
preproc_consume(_LKLAMMER);
|
||||||
|
current_scanner.skipspace;
|
||||||
|
|
||||||
|
result:=preproc_factor(false);
|
||||||
|
if current_scanner.preproc_token =_RKLAMMER then
|
||||||
|
preproc_consume(_RKLAMMER)
|
||||||
|
else
|
||||||
|
Message(scan_e_error_in_preproc_expr);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
9
tests/tbs/tb0608.pp
Normal file
9
tests/tbs/tb0608.pp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const
|
||||||
|
c = {$IF Declared(o) And (o<>Integer(0))}Succ{$IFEND}(False);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if c then
|
||||||
|
halt(1);
|
||||||
|
writeln('ok');
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user