Merge remote-tracking branch 'remotes/Daniel-Cortez/fix-632' into dev
This commit is contained in:
commit
85814e7802
@ -3246,8 +3246,6 @@ static int getstates(const char *funcname)
|
|||||||
static void attachstatelist(symbol *sym, int state_id)
|
static void attachstatelist(symbol *sym, int state_id)
|
||||||
{
|
{
|
||||||
assert(sym!=NULL);
|
assert(sym!=NULL);
|
||||||
if ((sym->usage & uDEFINE)!=0 && (sym->states==NULL || state_id==0))
|
|
||||||
error(21,sym->name); /* function already defined, either without states or the current definition has no states */
|
|
||||||
|
|
||||||
if (state_id!=0) {
|
if (state_id!=0) {
|
||||||
/* add the state list id */
|
/* add the state list id */
|
||||||
@ -3947,7 +3945,6 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc
|
|||||||
state_id=getstates(symbolname);
|
state_id=getstates(symbolname);
|
||||||
if (state_id>0 && (opertok!=0 || strcmp(symbolname,uMAINFUNC)==0))
|
if (state_id>0 && (opertok!=0 || strcmp(symbolname,uMAINFUNC)==0))
|
||||||
error(82); /* operators may not have states, main() may neither */
|
error(82); /* operators may not have states, main() may neither */
|
||||||
attachstatelist(sym,state_id);
|
|
||||||
pc_deprecate=bck_deprecate;
|
pc_deprecate=bck_deprecate;
|
||||||
pc_attributes=bck_attributes;
|
pc_attributes=bck_attributes;
|
||||||
if (matchtoken(t__PRAGMA))
|
if (matchtoken(t__PRAGMA))
|
||||||
@ -3959,9 +3956,12 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc
|
|||||||
sym->usage|=uFORWARD;
|
sym->usage|=uFORWARD;
|
||||||
if (!sc_needsemicolon)
|
if (!sc_needsemicolon)
|
||||||
error(218); /* old style prototypes used with optional semicolons */
|
error(218); /* old style prototypes used with optional semicolons */
|
||||||
|
if (state_id!=0)
|
||||||
|
error(231); /* state specification on forward declaration is ignored */
|
||||||
delete_symbols(&loctab,0,TRUE,TRUE); /* prototype is done; forget everything */
|
delete_symbols(&loctab,0,TRUE,TRUE); /* prototype is done; forget everything */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
attachstatelist(sym,state_id);
|
||||||
/* so it is not a prototype, proceed */
|
/* so it is not a prototype, proceed */
|
||||||
/* if this is a function that is not referred to (this can only be detected
|
/* if this is a function that is not referred to (this can only be detected
|
||||||
* in the second stage), shut code generation off */
|
* in the second stage), shut code generation off */
|
||||||
@ -3970,6 +3970,8 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc
|
|||||||
cidx=code_idx;
|
cidx=code_idx;
|
||||||
glbdecl=glb_declared;
|
glbdecl=glb_declared;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
if ((sym->usage & uDEFINE)!=0 && (sym->states==NULL || state_id==0))
|
||||||
|
error(21,sym->name); /* function already defined, either without states or the current definition has no states */
|
||||||
if ((sym->flags & flagDEPRECATED)!=0 && fpublic) {
|
if ((sym->flags & flagDEPRECATED)!=0 && fpublic) {
|
||||||
char *ptr= (sym->documentation!=NULL) ? sym->documentation : "";
|
char *ptr= (sym->documentation!=NULL) ? sym->documentation : "";
|
||||||
error(234,symbolname,ptr); /* deprecated (definitely a public function) */
|
error(234,symbolname,ptr); /* deprecated (definitely a public function) */
|
||||||
|
7
source/compiler/tests/warning_231.meta
Normal file
7
source/compiler/tests/warning_231.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
'test_type': 'output_check',
|
||||||
|
'errors': """
|
||||||
|
warning_231.pwn(3) : warning 231: state specification on forward declaration is ignored
|
||||||
|
warning_231.pwn(6) : warning 231: state specification on forward declaration is ignored
|
||||||
|
"""
|
||||||
|
}
|
9
source/compiler/tests/warning_231.pwn
Normal file
9
source/compiler/tests/warning_231.pwn
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma option -;+
|
||||||
|
|
||||||
|
forward Func() <auto1:st1>; // warning 231: state specification on forward declaration is ignored
|
||||||
|
public Func() <auto1:st1> {}
|
||||||
|
|
||||||
|
public Func() <auto1:st2>; // warning 231: state specification on forward declaration is ignored
|
||||||
|
public Func() <auto1:st2> {}
|
||||||
|
|
||||||
|
main(){}
|
Loading…
x
Reference in New Issue
Block a user