* Move global variable in_preproc_comp_expr into tscannerfile class.

git-svn-id: trunk@36133 -
This commit is contained in:
maciej-izak 2017-05-06 12:12:50 +00:00
parent d493980bb2
commit 631d4a2d53
2 changed files with 8 additions and 6 deletions

View File

@ -143,6 +143,9 @@ interface
preproc_pattern : string; preproc_pattern : string;
preproc_token : ttoken; preproc_token : ttoken;
{ true, if we are parsing preprocessor expressions }
in_preproc_comp_expr : boolean;
constructor Create(const fn:string; is_macro: boolean = false); constructor Create(const fn:string; is_macro: boolean = false);
destructor Destroy;override; destructor Destroy;override;
{ File buffer things } { File buffer things }
@ -238,9 +241,6 @@ interface
{$endif PREPROCWRITE} {$endif PREPROCWRITE}
var var
{ true, if we are parsing preprocessor expressions }
in_preproc_comp_expr: boolean = false;
{ read strings } { read strings }
c : char; c : char;
orgpattern, orgpattern,
@ -2120,12 +2120,12 @@ type
end; end;
begin begin
in_preproc_comp_expr:=true; current_scanner.in_preproc_comp_expr:=true;
current_scanner.skipspace; current_scanner.skipspace;
{ start preproc expression scanner } { start preproc expression scanner }
current_scanner.preproc_token:=current_scanner.readpreproc; current_scanner.preproc_token:=current_scanner.readpreproc;
preproc_comp_expr:=preproc_sub_expr(opcompare,true); preproc_comp_expr:=preproc_sub_expr(opcompare,true);
in_preproc_comp_expr:=false; current_scanner.in_preproc_comp_expr:=false;
end; end;
function boolean_compile_time_expr(var valuedescr: string): Boolean; function boolean_compile_time_expr(var valuedescr: string): Boolean;

View File

@ -2799,7 +2799,9 @@ implementation
begin begin
{ for symbols used in preprocessor expressions, we don't want to { for symbols used in preprocessor expressions, we don't want to
increase references count (for smaller final binaries) } increase references count (for smaller final binaries) }
if in_preproc_comp_expr then if not assigned(current_scanner) then
internalerror(2017050601);
if current_scanner.in_preproc_comp_expr then
exit; exit;
{ symbol uses count } { symbol uses count }
sym.IncRefCount; sym.IncRefCount;