mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-06 20:30:15 +00:00
Give an error when trying to evaluate constant expressions with long long operands.
This commit is contained in:
parent
2408c9602c
commit
5e5434987b
@ -1058,6 +1058,10 @@ var
|
||||
op^.left := Pop;
|
||||
kindRight := op^.right^.token.kind;
|
||||
kindLeft := op^.left^.token.kind;
|
||||
if not (kind in [normalExpression,autoInitializerExpression]) then
|
||||
if (kindLeft in [longlongconst,ulonglongconst])
|
||||
or (kindRight in [longlongconst,ulonglongconst]) then
|
||||
Error(157);
|
||||
if kindRight in [intconst,uintconst,longconst,ulongconst] then begin
|
||||
if kindLeft in [intconst,uintconst,longconst,ulongconst] then begin
|
||||
if kind = preprocessorExpression then begin
|
||||
@ -1378,6 +1382,9 @@ var
|
||||
else if not (op^.token.kind in
|
||||
[typedef,plusplusop,minusminusop,opplusplus,opminusminus,uand]) then
|
||||
begin
|
||||
if not (kind in [normalExpression,autoInitializerExpression]) then
|
||||
if op^.left^.token.kind in [longlongconst,ulonglongconst] then
|
||||
Error(157);
|
||||
if (op^.left^.token.kind
|
||||
in [intconst,uintconst,longconst,ulongconst]) then begin
|
||||
|
||||
|
@ -687,6 +687,7 @@ if list or (numErr <> 0) then begin
|
||||
154: msg := @'lint: function declared _Noreturn can return or has unreachable code';
|
||||
155: msg := @'lint: non-void function may not return a value or has unreachable code';
|
||||
156: msg := @'invalid suffix on numeric constant';
|
||||
157: msg := @'ORCA/C cannot evaluate this constant expression with long long operand(s)';
|
||||
otherwise: Error(57);
|
||||
end; {case}
|
||||
writeln(msg^);
|
||||
|
Loading…
x
Reference in New Issue
Block a user