mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-19 03:07:00 +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;
|
||||
until done or (token.kind = eofsy);
|
||||
if maxCount = 0 then begin {set the array size}
|
||||
maxCount := (maxDisp - startingDisp + ktp^.size - 1) div ktp^.size;
|
||||
tp^.elements := maxCount;
|
||||
RecomputeSizes(variable^.itype);
|
||||
if maxDisp <> startingDisp then begin
|
||||
maxCount := (maxDisp - startingDisp + ktp^.size-1) div ktp^.size;
|
||||
tp^.elements := maxCount;
|
||||
RecomputeSizes(variable^.itype);
|
||||
end {if}
|
||||
else begin
|
||||
Error(49);
|
||||
errorFound := true;
|
||||
end; {else}
|
||||
end; {if}
|
||||
if braces then begin
|
||||
disp := startingDisp + maxCount * ktp^.size;
|
||||
|
Loading…
Reference in New Issue
Block a user