Skip to content

Commit 8c36d42

Browse files
committed
Only require function definitions to have all specifiers introduced in forward declarations
1 parent 14009f6 commit 8c36d42

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

source/compiler/sc1.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3777,9 +3777,6 @@ static void funcstub(int fnative)
37773777
sym->usage=(short)(uNATIVE | uRETVALUE | uDEFINE | (sym->usage & uPROTOTYPED));
37783778
sym->x.lib=curlibrary;
37793779
} else {
3780-
if (((sym->usage & uDECLPUBLIC)!=0 && !fpublic) || ((sym->usage & uDECLSTATIC)!=0 && !fstatic)
3781-
|| ((sym->usage & uSTOCK)!=0 && !fstock))
3782-
error(25); /* function heading differs from prototype */
37833780
if ((sym->usage & uDEFINE)!=0) {
37843781
/* if the function has already been defined ("finalized"), we can't accept
37853782
* any new class specifiers */
@@ -3938,9 +3935,6 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int fsto
39383935
sym=fetchfunc(symbolname,tag);/* get a pointer to the function entry */
39393936
if (sym==NULL || (sym->usage & uNATIVE)!=0)
39403937
return TRUE; /* it was recognized as a function declaration, but not as a valid one */
3941-
if (((sym->usage & uDECLPUBLIC)!=0 && !fpublic) || ((sym->usage & uDECLSTATIC)!=0 && !fstatic)
3942-
|| ((sym->usage & uSTOCK)!=0 && !fstock))
3943-
error(25); /* function heading differs from prototype */
39443938
if (fpublic && opertok==0)
39453939
sym->usage |= (uPUBLIC | uDECLPUBLIC);
39463940
if (fstatic) {
@@ -3991,6 +3985,9 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int fsto
39913985
return TRUE;
39923986
} /* if */
39933987
/* so it is not a prototype, proceed */
3988+
if (((sym->usage & uDECLPUBLIC)!=0 && !fpublic) || ((sym->usage & uDECLSTATIC)!=0 && !fstatic)
3989+
|| ((sym->usage & uSTOCK)!=0 && !fstock))
3990+
error(25); /* function heading differs from prototype */
39943991
/* if this is a function that is not referred to (this can only be detected
39953992
* in the second stage), shut code generation off */
39963993
if (sc_status==statWRITE && (sym->usage & uREAD)==0 && !fpublic) {

0 commit comments

Comments
 (0)