mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-17 12:32:07 +00:00
Give error for arrays that are still 0 size after initialization.
This prohibits empty initializers ({}) for arrays of unknown size, consistent with C23 requirements. Previous versions of C did not allow empty initializers at all, but ORCA/C historically did in some cases, so this patch still allows them for structs/unions/arrays of known size.
This commit is contained in:
parent
e7940db4c8
commit
94584b0f05
12
Parser.pas
12
Parser.pas
@ -2595,9 +2595,15 @@ var
|
|||||||
done := true;
|
done := true;
|
||||||
until done or (token.kind = eofsy);
|
until done or (token.kind = eofsy);
|
||||||
if maxCount = 0 then begin {set the array size}
|
if maxCount = 0 then begin {set the array size}
|
||||||
maxCount := (maxDisp - startingDisp + ktp^.size - 1) div ktp^.size;
|
if maxDisp <> startingDisp then begin
|
||||||
tp^.elements := maxCount;
|
maxCount := (maxDisp - startingDisp + ktp^.size-1) div ktp^.size;
|
||||||
RecomputeSizes(variable^.itype);
|
tp^.elements := maxCount;
|
||||||
|
RecomputeSizes(variable^.itype);
|
||||||
|
end {if}
|
||||||
|
else begin
|
||||||
|
Error(49);
|
||||||
|
errorFound := true;
|
||||||
|
end; {else}
|
||||||
end; {if}
|
end; {if}
|
||||||
if braces then begin
|
if braces then begin
|
||||||
disp := startingDisp + maxCount * ktp^.size;
|
disp := startingDisp + maxCount * ktp^.size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user