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:
Stephen Heumann 2016-10-15 19:47:06 -05:00
parent 1077c35a49
commit b019c59803
2 changed files with 8 additions and 3 deletions

View File

@ -2535,7 +2535,9 @@ var
disp := disp + variable^.itype^.size;
if disp > maxDisp then
maxDisp := disp;
end; {if}
end {if}
else
Error(116);
if token.kind = commach then {allow repeated declarations}
begin
NextToken;
@ -2543,7 +2545,9 @@ var
end {if}
else
done := true;
until done or (token.kind = eofsy);
until done or (token.kind = eofsy)
else
Error(116);
Match(semicolonch,22); {insist on a closing ';'}
end; {while}
if fl <> nil then begin

View File

@ -533,7 +533,7 @@ if list or (numErr <> 0) then begin
50: msg := @'only parameters or types may be declared here';
51: msg := @'lint: undefined function';
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';
55: msg := @'a value cannot be zero bits wide';
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';
114: msg := @'a function call was made to a non-function';
115: msg := @'illegal bit field declaration';
116: msg := @'missing field name';
otherwise: Error(57);
end; {case}
writeln(msg^);