mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-30 22:42:33 +02:00
Revert revision 36436 from trunk. Final fix for issue #31675.
git-svn-id: trunk@36446 -
This commit is contained in:
parent
748428b637
commit
751bde9792
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -15565,6 +15565,7 @@ tests/webtbs/tw3160b.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3160c.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3161.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3165.pp svneol=native#text/plain
|
||||
tests/webtbs/tw31675.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3168.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3170.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3172.pp svneol=native#text/plain
|
||||
@ -16228,6 +16229,7 @@ tests/webtbs/uw2956.pp svneol=native#text/plain
|
||||
tests/webtbs/uw2984.pp svneol=native#text/plain
|
||||
tests/webtbs/uw3103.pp svneol=native#text/plain
|
||||
tests/webtbs/uw31431.pp svneol=native#text/pascal
|
||||
tests/webtbs/uw31675.pp svneol=native#text/pascal
|
||||
tests/webtbs/uw3179a.pp svneol=native#text/plain
|
||||
tests/webtbs/uw3179b.pp svneol=native#text/plain
|
||||
tests/webtbs/uw3184a.pp svneol=native#text/plain
|
||||
|
@ -143,6 +143,9 @@ interface
|
||||
preproc_pattern : string;
|
||||
preproc_token : ttoken;
|
||||
|
||||
{ true, if we are parsing preprocessor expressions }
|
||||
in_preproc_comp_expr : boolean;
|
||||
|
||||
constructor Create(const fn:string; is_macro: boolean = false);
|
||||
destructor Destroy;override;
|
||||
{ File buffer things }
|
||||
@ -2117,10 +2120,12 @@ type
|
||||
end;
|
||||
|
||||
begin
|
||||
current_scanner.in_preproc_comp_expr:=true;
|
||||
current_scanner.skipspace;
|
||||
{ start preproc expression scanner }
|
||||
current_scanner.preproc_token:=current_scanner.readpreproc;
|
||||
preproc_comp_expr:=preproc_sub_expr(opcompare,true);
|
||||
current_scanner.in_preproc_comp_expr:=false;
|
||||
end;
|
||||
|
||||
function boolean_compile_time_expr(var valuedescr: string): Boolean;
|
||||
|
@ -459,7 +459,9 @@ implementation
|
||||
{ codegen }
|
||||
procinfo,
|
||||
{ ppu }
|
||||
entfile
|
||||
entfile,
|
||||
{ parser }
|
||||
scanner
|
||||
;
|
||||
|
||||
|
||||
@ -2795,6 +2797,12 @@ implementation
|
||||
var
|
||||
owner: tsymtable;
|
||||
begin
|
||||
{ for symbols used in preprocessor expressions, we don't want to
|
||||
increase references count (for smaller final binaries) }
|
||||
if not assigned(current_scanner) then
|
||||
internalerror(2017050601);
|
||||
if current_scanner.in_preproc_comp_expr then
|
||||
exit;
|
||||
{ symbol uses count }
|
||||
sym.IncRefCount;
|
||||
owner:=sym.owner;
|
||||
|
25
tests/webtbs/tw31675.pp
Normal file
25
tests/webtbs/tw31675.pp
Normal file
@ -0,0 +1,25 @@
|
||||
{ %opt=-gh }
|
||||
|
||||
program tw31675;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes,
|
||||
{$if declared(useheaptrace)}
|
||||
uw31675,
|
||||
{$endif}
|
||||
SysUtils
|
||||
;
|
||||
|
||||
var
|
||||
i: Boolean = false;
|
||||
begin
|
||||
{$if declared(foo)}
|
||||
i := true;
|
||||
{$endif}
|
||||
if not i then
|
||||
Halt(1);
|
||||
WriteLn('ok');
|
||||
end.
|
||||
|
13
tests/webtbs/uw31675.pp
Normal file
13
tests/webtbs/uw31675.pp
Normal file
@ -0,0 +1,13 @@
|
||||
unit uw31675;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
interface
|
||||
|
||||
var
|
||||
foo: boolean;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user