mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-03 10:29:41 +00:00
Flag an error if a struct or enum field declaration contains no declarator (i.e. no name).
This may be someone trying to use a C11-style anonymous struct/union, which should be flagged as an error until and unless those are supported. Otherwise, it probably just indicates that the programmer is confused. In any case, an error should be flagged for it.
This commit is contained in:
parent
1077c35a49
commit
b019c59803
@ -2535,7 +2535,9 @@ var
|
|||||||
disp := disp + variable^.itype^.size;
|
disp := disp + variable^.itype^.size;
|
||||||
if disp > maxDisp then
|
if disp > maxDisp then
|
||||||
maxDisp := disp;
|
maxDisp := disp;
|
||||||
end; {if}
|
end {if}
|
||||||
|
else
|
||||||
|
Error(116);
|
||||||
if token.kind = commach then {allow repeated declarations}
|
if token.kind = commach then {allow repeated declarations}
|
||||||
begin
|
begin
|
||||||
NextToken;
|
NextToken;
|
||||||
@ -2543,7 +2545,9 @@ var
|
|||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
done := true;
|
done := true;
|
||||||
until done or (token.kind = eofsy);
|
until done or (token.kind = eofsy)
|
||||||
|
else
|
||||||
|
Error(116);
|
||||||
Match(semicolonch,22); {insist on a closing ';'}
|
Match(semicolonch,22); {insist on a closing ';'}
|
||||||
end; {while}
|
end; {while}
|
||||||
if fl <> nil then begin
|
if fl <> nil then begin
|
||||||
|
@ -533,7 +533,7 @@ if list or (numErr <> 0) then begin
|
|||||||
50: msg := @'only parameters or types may be declared here';
|
50: msg := @'only parameters or types may be declared here';
|
||||||
51: msg := @'lint: undefined function';
|
51: msg := @'lint: undefined function';
|
||||||
52: msg := @'you cannot initialize a type';
|
52: msg := @'you cannot initialize a type';
|
||||||
53: msg := @'the structure has already been defined';
|
53: msg := @'the structure or union has already been defined';
|
||||||
54: msg := @'bit fields must be less than 32 bits wide';
|
54: msg := @'bit fields must be less than 32 bits wide';
|
||||||
55: msg := @'a value cannot be zero bits wide';
|
55: msg := @'a value cannot be zero bits wide';
|
||||||
56: msg := @'bit fields in unions are not supported by ORCA/C';
|
56: msg := @'bit fields in unions are not supported by ORCA/C';
|
||||||
@ -596,6 +596,7 @@ if list or (numErr <> 0) then begin
|
|||||||
113: msg := @'all parameters must have a name';
|
113: msg := @'all parameters must have a name';
|
||||||
114: msg := @'a function call was made to a non-function';
|
114: msg := @'a function call was made to a non-function';
|
||||||
115: msg := @'illegal bit field declaration';
|
115: msg := @'illegal bit field declaration';
|
||||||
|
116: msg := @'missing field name';
|
||||||
otherwise: Error(57);
|
otherwise: Error(57);
|
||||||
end; {case}
|
end; {case}
|
||||||
writeln(msg^);
|
writeln(msg^);
|
||||||
|
Loading…
Reference in New Issue
Block a user