Disallow duplicate suffixes on numeric constants (e.g. "123ulu").

This commit is contained in:
Stephen Heumann 2021-02-02 18:28:49 -06:00
parent 8ac887f4dc
commit 1b9ee39de7

View File

@ -685,6 +685,7 @@ if list or (numErr <> 0) then begin
153: msg := @'lint: return statement in function declared _Noreturn'; 153: msg := @'lint: return statement in function declared _Noreturn';
154: msg := @'lint: function declared _Noreturn can return or has unreachable code'; 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'; 155: msg := @'lint: non-void function may not return a value or has unreachable code';
156: msg := @'invalid suffix on numeric constant';
otherwise: Error(57); otherwise: Error(57);
end; {case} end; {case}
writeln(msg^); writeln(msg^);
@ -3277,14 +3278,17 @@ if c2 in ['e','E'] then begin {handle an exponent}
while c2 in ['l','u','L','U'] do {check for long or unsigned} while c2 in ['l','u','L','U'] do {check for long or unsigned}
if c2 in ['l','L'] then begin if c2 in ['l','L'] then begin
NextChar; NextChar;
if not isReal then if isLong then
isLong := true; FlagError(156);
isLong := true;
end {if} end {if}
else {if c2 in ['u','U'] then} begin else {if c2 in ['u','U'] then} begin
NextChar; NextChar;
unsigned := true; if unsigned then
if isReal then FlagError(156)
else if isReal then
FlagError(91); FlagError(91);
unsigned := true;
end; {else} end; {else}
if c2 in ['f','F'] then begin {allow F designator on reals} if c2 in ['f','F'] then begin {allow F designator on reals}
if unsigned then if unsigned then