mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-01 16:31:10 +00:00
Restrict bit fields to having integer types, and to having no more bits than the type specified.
C89 restricts bit fields to (signed) int and unsigned int only, although later standards note that additional types may be supported. ORCA/C supports the other integer types as an extension. This fixes the compco01.c test case.
This commit is contained in:
parent
f7c3c26794
commit
1077c35a49
10
Parser.pas
10
Parser.pas
@ -2512,7 +2512,15 @@ var
|
||||
variable^.bitdisp := bitdisp;
|
||||
variable^.bitsize := long(expressionValue).lsw;
|
||||
bitdisp := bitdisp+long(expressionValue).lsw;
|
||||
end; {if}
|
||||
tPtr := variable^.itype;
|
||||
end {if}
|
||||
else
|
||||
tPtr := typeSpec;
|
||||
if (tPtr^.kind <> scalarType)
|
||||
or not (tPtr^.baseType in
|
||||
[cgByte,cgUByte,cgWord,cgUWord,cgLong,cgULong])
|
||||
or (expressionValue > tPtr^.size*8) then
|
||||
Error(115);
|
||||
end {if}
|
||||
else if variable <> nil then begin
|
||||
if bitdisp <> 0 then begin
|
||||
|
@ -595,6 +595,7 @@ if list or (numErr <> 0) then begin
|
||||
112: msg := @'segment buffer overflow';
|
||||
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';
|
||||
otherwise: Error(57);
|
||||
end; {case}
|
||||
writeln(msg^);
|
||||
|
Loading…
x
Reference in New Issue
Block a user