Use cgPointerSize for size of pointers in various places.

This makes no practical difference when targeting the GS, but it better documents what the relevant size is.
This commit is contained in:
Stephen Heumann 2022-06-18 19:30:20 -05:00
parent a3104853fc
commit 58849607a1
3 changed files with 15 additions and 12 deletions

View File

@ -1917,7 +1917,7 @@ var
codeGeneration := lCodeGeneration and (numErrors = 0);
{get controlling type after conversions}
if expressionType^.kind = functionType then begin
controllingType.size := cgLongSize;
controllingType.size := cgPointerSize;
controllingType.saveDisp := 0;
controllingType.qualifiers := [];
controllingType.kind := pointerType;
@ -1932,8 +1932,11 @@ var
end {else if}
else
controllingType := expressionType^;
if controllingType.kind = arrayType then
if controllingType.kind = arrayType then begin
controllingType.kind := pointerType;
controllingType.size := cgPointerSize;
controllingType.saveDisp := 0;
end; {if}
controllingType.qualifiers := [];
typesSeen := nil;
@ -2868,7 +2871,7 @@ var
otherwise: ;
end; {case}
eType := pointer(Malloc(sizeof(typeRecord)));
eType^.size := cgLongSize;
eType^.size := cgPointerSize;
eType^.saveDisp := 0;
eType^.qualifiers := [];
eType^.kind := pointerType;
@ -2912,7 +2915,7 @@ var
Gen0(pc_adl);
end; {else}
eType := pointer(Malloc(sizeof(typeRecord)));
eType^.size := cgLongSize;
eType^.size := cgPointerSize;
eType^.saveDisp := 0;
eType^.qualifiers := [];
eType^.kind := pointerType;
@ -2929,7 +2932,7 @@ var
expressionType := tree^.castType;
if expressionType^.kind <> arrayType then begin
eType := pointer(Malloc(sizeof(typeRecord)));
eType^.size := cgLongSize;
eType^.size := cgPointerSize;
eType^.saveDisp := 0;
eType^.qualifiers := [];
eType^.kind := pointerType;
@ -4232,7 +4235,7 @@ case tree^.token.kind of
ChangePointer(pc_adl, lType^.size, et);
if expressionType^.kind = arrayType then begin
tType := pointer(Malloc(sizeof(typeRecord)));
tType^.size := cgLongSize;
tType^.size := cgPointerSize;
tType^.saveDisp := 0;
tType^.qualifiers := [];
tType^.kind := pointerType;
@ -4288,7 +4291,7 @@ case tree^.token.kind of
expressionType := lType;
if expressionType^.kind = arrayType then begin
tType := pointer(Malloc(sizeof(typeRecord)));
tType^.size := cgLongSize;
tType^.size := cgPointerSize;
tType^.saveDisp := 0;
tType^.qualifiers := [];
tType^.kind := pointerType;
@ -4515,7 +4518,7 @@ case tree^.token.kind of
{build pointer-to-array type for address of string constant}
tType := pointer(Malloc(sizeof(typeRecord)));
with tType^ do begin
size := cgLongSize;
size := cgPointerSize;
saveDisp := 0;
qualifiers := [];
kind := pointerType;

View File

@ -4136,7 +4136,7 @@ var
{create a pointer type}
NextToken;
tp := pointer(Malloc(sizeof(typeRecord)));
tp^.size := cgLongSize;
tp^.size := cgPointerSize;
tp^.saveDisp := 0;
tp^.qualifiers := [];
tp^.kind := pointerType;

View File

@ -581,7 +581,7 @@ case kind1 of
if tp1.kind = arrayType then
tp1.kind := pointerType
else if tp1.kind = functionType then begin
tp1.size := cgLongSize;
tp1.size := cgPointerSize;
tp1.qualifiers := [];
tp1.saveDisp := 0;
tp1.kind := pointerType;
@ -590,7 +590,7 @@ case kind1 of
if tp2.kind = arrayType then
tp2.kind := pointerType
else if tp2.kind = functionType then begin
tp2.size := cgLongSize;
tp2.size := cgPointerSize;
tp2.qualifiers := [];
tp2.saveDisp := 0;
tp2.kind := pointerType;
@ -1644,7 +1644,7 @@ with voidPtr^ do begin
end; {with}
new(voidPtrPtr); {typeless pointer}
with voidPtrPtr^ do begin
size := 4;
size := cgPointerSize;
saveDisp := 0;
qualifiers := [];
kind := pointerType;