Require that main have no function specifiers.

This enforces a constraint in the C standards (for a hosted environment).
This commit is contained in:
Stephen Heumann 2022-10-29 18:36:51 -05:00
parent 913052fe7c
commit f54d0e1854
2 changed files with 5 additions and 0 deletions

View File

@ -3781,6 +3781,10 @@ if isFunction then begin
if isInline then
if declSpecifiers.storageClass <> staticsy then
Error(120);
if isInline or isNoreturn then
if not (isNewDeskAcc or isClassicDeskAcc or isCDev or isNBA or isXCMD) then
if variable^.name^ = 'main' then
Error(181);
if alignmentSpecified then
Error(142);
if _Thread_localsy in declSpecifiers.declarationModifiers then

View File

@ -775,6 +775,7 @@ if list or (numErr <> 0) then begin
178: msg := @'_Thread_local may not appear in a function declaration';
179: msg := @'_Pragma requires one string literal argument';
180: msg := @'decimal digit sequence expected';
181: msg := @'''main'' may not have any function specifiers';
otherwise: Error(57);
end; {case}
writeln(msg^);