Try to fix bug introduced in previous commit #42527, hopefully fixing bug report 35902

git-svn-id: trunk@42528 -
This commit is contained in:
pierre 2019-07-29 11:54:27 +00:00
parent f2b200e4f0
commit 92f085fdd9

View File

@ -146,7 +146,7 @@ interface
{ true, if we are parsing preprocessor expressions } { true, if we are parsing preprocessor expressions }
in_preproc_comp_expr : boolean; in_preproc_comp_expr : boolean;
{ true if cross-compiling for a CPU in opposite endianess} { true if cross-compiling for a CPU in opposite endianess}
change_endian : boolean; change_endian_for_tokens : 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;
@ -286,7 +286,7 @@ implementation
symbase,symtable,symtype,symsym,symconst,symdef,defutil, symbase,symtable,symtype,symsym,symconst,symdef,defutil,
{ This is needed for tcputype } { This is needed for tcputype }
cpuinfo, cpuinfo,
fmodule, fmodule,fppu,
{ this is needed for $I %CURRENTROUTINE%} { this is needed for $I %CURRENTROUTINE%}
procinfo procinfo
{$if FPC_FULLVERSION<20700} {$if FPC_FULLVERSION<20700}
@ -2709,11 +2709,10 @@ type
lasttoken:=NOTOKEN; lasttoken:=NOTOKEN;
nexttoken:=NOTOKEN; nexttoken:=NOTOKEN;
ignoredirectives:=TFPHashList.Create; ignoredirectives:=TFPHashList.Create;
{$ifdef FPC_BIG_ENDIAN} if (current_module is tppumodule) and assigned(tppumodule(current_module).ppufile) then
change_endian:=(target_info.endian=endian_little); change_endian_for_tokens:=tppumodule(current_module).ppufile.change_endian
{$else} else
change_endian:=(target_info.endian=endian_big); change_endian_for_tokens:=false;
{$endif}
end; end;
@ -2914,7 +2913,7 @@ type
val : asizeint; val : asizeint;
begin begin
replaytokenbuf.read(val,sizeof(asizeint)); replaytokenbuf.read(val,sizeof(asizeint));
if change_endian then if change_endian_for_tokens then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2924,7 +2923,7 @@ type
val : longword; val : longword;
begin begin
replaytokenbuf.read(val,sizeof(longword)); replaytokenbuf.read(val,sizeof(longword));
if change_endian then if change_endian_for_tokens then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2934,7 +2933,7 @@ type
val : longint; val : longint;
begin begin
replaytokenbuf.read(val,sizeof(longint)); replaytokenbuf.read(val,sizeof(longint));
if change_endian then if change_endian_for_tokens then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2960,7 +2959,7 @@ type
val : smallint; val : smallint;
begin begin
replaytokenbuf.read(val,sizeof(smallint)); replaytokenbuf.read(val,sizeof(smallint));
if change_endian then if change_endian_for_tokens then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2970,7 +2969,7 @@ type
val : word; val : word;
begin begin
replaytokenbuf.read(val,sizeof(word)); replaytokenbuf.read(val,sizeof(word));
if change_endian then if change_endian_for_tokens then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2992,7 +2991,7 @@ type
i : longint; i : longint;
begin begin
replaytokenbuf.read(b,size); replaytokenbuf.read(b,size);
if change_endian then if change_endian_for_tokens then
for i:=0 to size-1 do for i:=0 to size-1 do
Pbyte(@b)[i]:=reverse_byte(Pbyte(@b)[i]); Pbyte(@b)[i]:=reverse_byte(Pbyte(@b)[i]);
end; end;