mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-10 22:29:27 +00:00
Fix to make _Generic handle struct types properly.
Also, use an existing error message instead of creating a new equivalent one.
This commit is contained in:
parent
bccd86a627
commit
2de8ac993e
|
@ -1892,6 +1892,13 @@ var
|
||||||
controllingType.kind := pointerType;
|
controllingType.kind := pointerType;
|
||||||
controllingType.pType := expressionType;
|
controllingType.pType := expressionType;
|
||||||
end {if}
|
end {if}
|
||||||
|
else if expressionType^.kind in [structType,unionType] then begin
|
||||||
|
controllingType.size := expressionType^.size;
|
||||||
|
controllingType.saveDisp := 0;
|
||||||
|
controllingType.isConstant := false;
|
||||||
|
controllingType.kind := definedType;
|
||||||
|
controllingType.dType := expressionType;
|
||||||
|
end {else if}
|
||||||
else
|
else
|
||||||
controllingType := expressionType^;
|
controllingType := expressionType^;
|
||||||
if controllingType.kind = arrayType then
|
if controllingType.kind = arrayType then
|
||||||
|
@ -1910,7 +1917,7 @@ var
|
||||||
TypeName; {get the type name}
|
TypeName; {get the type name}
|
||||||
currentType := typeSpec;
|
currentType := typeSpec;
|
||||||
if (currentType^.size = 0) or (currentType^.kind = functionType) then
|
if (currentType^.size = 0) or (currentType^.kind = functionType) then
|
||||||
Error(161);
|
Error(133);
|
||||||
tl := typesSeen; {check if it is a duplicate}
|
tl := typesSeen; {check if it is a duplicate}
|
||||||
while tl <> nil do begin
|
while tl <> nil do begin
|
||||||
if CompTypes(currentType, tl^.theType) then begin
|
if CompTypes(currentType, tl^.theType) then begin
|
||||||
|
|
|
@ -699,7 +699,6 @@ if list or (numErr <> 0) then begin
|
||||||
158: msg := @'_Generic expression includes two compatible types';
|
158: msg := @'_Generic expression includes two compatible types';
|
||||||
159: msg := @'_Generic expression includes multiple default cases';
|
159: msg := @'_Generic expression includes multiple default cases';
|
||||||
160: msg := @'no matching association in _Generic expression';
|
160: msg := @'no matching association in _Generic expression';
|
||||||
161: msg := @'complete object type expected';
|
|
||||||
otherwise: Error(57);
|
otherwise: Error(57);
|
||||||
end; {case}
|
end; {case}
|
||||||
writeln(msg^);
|
writeln(msg^);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user