1
0
Fork 0
forked from fte/fteqw

fixing a problem with functions passed as parameters killing the local names.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@112 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-02 12:58:49 +00:00
parent 3b26e6ff2f
commit 7fe24ba394

View file

@ -2061,13 +2061,19 @@ void VARGS QCC_PR_ParseWarning (int type, char *error, ...)
va_list argptr; va_list argptr;
char string[1024]; char string[1024];
if (qccwarningdisabled[type]) if (type < ERR_PARSEERRORS && qccwarningdisabled[type])
return; return;
va_start (argptr,error); va_start (argptr,error);
QC_vsnprintf (string,sizeof(string)-1, error,argptr); QC_vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr); va_end (argptr);
if (type >= ERR_PARSEERRORS)
{
printf ("%s:%i: error: %s\n", strings + s_file, pr_source_line, string);
pr_error_count++;
}
else
printf ("%s:%i: warning: %s\n", strings + s_file, pr_source_line, string); printf ("%s:%i: warning: %s\n", strings + s_file, pr_source_line, string);
} }
@ -2383,12 +2389,18 @@ char pr_parm_names[MAX_PARMS+MAX_EXTRA_PARMS][MAX_NAME];
char pr_parm_names[MAX_PARMS][MAX_NAME]; char pr_parm_names[MAX_PARMS][MAX_NAME];
#endif #endif
pbool recursivefunctiontype;
QCC_type_t *QCC_PR_NewType (char *name, int basictype); QCC_type_t *QCC_PR_NewType (char *name, int basictype);
//expects a ( to have already been parsed. //expects a ( to have already been parsed.
QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype) QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
{ {
QCC_type_t *ftype, *ptype, *nptype; QCC_type_t *ftype, *ptype, *nptype;
char *name; char *name;
int definenames = !recursivefunctiontype;
recursivefunctiontype++;
ftype = QCC_PR_NewType(type_function->name, ev_function); ftype = QCC_PR_NewType(type_function->name, ev_function);
ftype->aux_type = returntype; // return type ftype->aux_type = returntype; // return type
@ -2432,15 +2444,17 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
if (STRCMP(pr_token, ",") && STRCMP(pr_token, ")")) if (STRCMP(pr_token, ",") && STRCMP(pr_token, ")"))
{ {
name = QCC_PR_ParseName (); name = QCC_PR_ParseName ();
if (definenames)
strcpy (pr_parm_names[ftype->num_parms], name); strcpy (pr_parm_names[ftype->num_parms], name);
} }
else else if (definenames)
strcpy (pr_parm_names[ftype->num_parms], ""); strcpy (pr_parm_names[ftype->num_parms], "");
ftype->num_parms++; ftype->num_parms++;
} while (QCC_PR_Check (",")); } while (QCC_PR_Check (","));
QCC_PR_Expect (")"); QCC_PR_Expect (")");
} }
recursivefunctiontype--;
if (newtype) if (newtype)
return ftype; return ftype;
return QCC_PR_FindType (ftype); return QCC_PR_FindType (ftype);