mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-15 08:29:27 +00:00
Record the type being initialized in auto initializer records.
This commit is contained in:
parent
cd9931a60c
commit
d1edc8821d
|
@ -327,7 +327,10 @@ type
|
||||||
bitsize: integer; {width in bits; 0 for byte sizes}
|
bitsize: integer; {width in bits; 0 for byte sizes}
|
||||||
isStructOrUnion: boolean; {is this a struct or union initializer?}
|
isStructOrUnion: boolean; {is this a struct or union initializer?}
|
||||||
case isConstant: boolean of {is this a constant initializer?}
|
case isConstant: boolean of {is this a constant initializer?}
|
||||||
false: (iTree: tokenPtr);
|
false: (
|
||||||
|
iType: typePtr; {type being initialized}
|
||||||
|
iTree: tokenPtr; {initializer expression}
|
||||||
|
);
|
||||||
true : ( {Note: qVal.lo must overlap iVal}
|
true : ( {Note: qVal.lo must overlap iVal}
|
||||||
case basetype: baseTypeEnum of
|
case basetype: baseTypeEnum of
|
||||||
cgByte,
|
cgByte,
|
||||||
|
|
|
@ -2348,6 +2348,7 @@ var
|
||||||
end; {else}
|
end; {else}
|
||||||
iPtr^.isConstant := false;
|
iPtr^.isConstant := false;
|
||||||
iPtr^.iTree := initializerTree;
|
iPtr^.iTree := initializerTree;
|
||||||
|
iPtr^.iType := tp;
|
||||||
iPtr^.bitdisp := bitdisp;
|
iPtr^.bitdisp := bitdisp;
|
||||||
iPtr^.bitsize := bitsize;
|
iPtr^.bitsize := bitsize;
|
||||||
end; {else}
|
end; {else}
|
||||||
|
@ -2465,6 +2466,7 @@ var
|
||||||
tk^.token.class := intConstant;
|
tk^.token.class := intConstant;
|
||||||
tk^.token.ival := 0;
|
tk^.token.ival := 0;
|
||||||
iPtr^.iTree := tk;
|
iPtr^.iTree := tk;
|
||||||
|
iPtr^.iType := tp;
|
||||||
end; {else}
|
end; {else}
|
||||||
if count < 16384 then begin
|
if count < 16384 then begin
|
||||||
iPtr^.count := long(count).lsw;
|
iPtr^.count := long(count).lsw;
|
||||||
|
@ -2562,6 +2564,7 @@ var
|
||||||
iPtr^.isConstant := false;
|
iPtr^.isConstant := false;
|
||||||
new(ep);
|
new(ep);
|
||||||
iPtr^.iTree := ep;
|
iPtr^.iTree := ep;
|
||||||
|
iPtr^.iType := tp;
|
||||||
ep^.next := nil;
|
ep^.next := nil;
|
||||||
ep^.left := nil;
|
ep^.left := nil;
|
||||||
ep^.middle := nil;
|
ep^.middle := nil;
|
||||||
|
@ -4520,6 +4523,10 @@ var
|
||||||
case itype^.kind of
|
case itype^.kind of
|
||||||
|
|
||||||
scalarType,pointerType,enumType,functionType: begin
|
scalarType,pointerType,enumType,functionType: begin
|
||||||
|
if not CompTypes(itype, iptr^.itype) then begin
|
||||||
|
writeln('Incompatible initializer type');
|
||||||
|
Error(57);
|
||||||
|
end; {debug}
|
||||||
tree := iptr^.itree;
|
tree := iptr^.itree;
|
||||||
if tree = nil then goto 2; {don't generate code in error case}
|
if tree = nil then goto 2; {don't generate code in error case}
|
||||||
LoadAddress; {load the destination address}
|
LoadAddress; {load the destination address}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user