Prohibit _Noreturn specifier on non-functions.

This commit is contained in:
Stephen Heumann 2020-01-19 14:57:28 -06:00
parent bc1f6eb457
commit a130e79929
2 changed files with 5 additions and 0 deletions

View File

@ -3122,6 +3122,7 @@ var
i: integer; {loop variable}
isAsm: boolean; {has the asm modifier been used?}
isInline: boolean; {has the inline specifier been used?}
isNoreturn: boolean; {has the _Noreturn specifier been used?}
lDoingParameters: boolean; {local copy of doingParameters}
lisPascal: boolean; {local copy of isPascal}
lp,tlp,tlp2: identPtr; {for tracing parameter list}
@ -3367,6 +3368,7 @@ DeclarationSpecifiers(declarationSpecifiersElement, ident);
isPascal := pascalsy in functionSpecifiers;
isAsm := asmsy in functionSpecifiers;
isInline := inlinesy in functionSpecifiers;
isNoreturn := _Noreturnsy in functionSpecifiers;
lisPascal := isPascal;
if not skipDeclarator then begin
variable := nil;
@ -3657,6 +3659,8 @@ else {if not isFunction then} begin
end; {if}
if isInline then
Error(119);
if isNoreturn then
Error(141);
if token.kind = eqch then begin
if storageClass = typedefsy then
Error(52);

View File

@ -662,6 +662,7 @@ if list or (numErr <> 0) then begin
138: msg := @'unsupported alignment';
139: msg := @'thread-local storage is not supported by ORCA/C';
140: msg := @'unexpected token';
141: msg := @'_Noreturn specifier is only allowed on functions';
otherwise: Error(57);
end; {case}
writeln(msg^);