mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-14 07:29:44 +00:00
Give an error for sizeof(bitfield).
This violates a constraint in the standards (C17 6.5.3.4 p1).
This commit is contained in:
parent
c2262929e9
commit
c8517eff87
@ -1712,12 +1712,16 @@ var
|
||||
if op^.token.kind = sizeofsy then begin
|
||||
op^.token.kind := ulongConst;
|
||||
op^.token.class := longConstant;
|
||||
if op^.left^.token.kind = stringConst then
|
||||
kindLeft := op^.left^.token.kind;
|
||||
if kindLeft = stringConst then
|
||||
op^.token.lval := op^.left^.token.sval^.length
|
||||
else begin
|
||||
lCodeGeneration := codeGeneration;
|
||||
codeGeneration := false;
|
||||
GenerateCode(op^.left);
|
||||
if kindLeft = dotch then
|
||||
if isBitfield then
|
||||
Error(49);
|
||||
codeGeneration := lCodeGeneration and (numErrors = 0);
|
||||
op^.token.lval := expressionType^.size;
|
||||
with expressionType^ do
|
||||
@ -4690,6 +4694,7 @@ case tree^.token.kind of
|
||||
|
||||
dotch: begin {.}
|
||||
LoadAddress(tree^.left, checkNullPointers);
|
||||
isBitfield := false;
|
||||
lType := expressionType;
|
||||
if lType^.kind in [arrayType,pointerType,structType,unionType] then begin
|
||||
if lType^.kind = arrayType then
|
||||
|
Loading…
x
Reference in New Issue
Block a user