forked from fte/fteqw
1
0
Fork 0

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
1 changed files with 18 additions and 4 deletions

View File

@ -2061,13 +2061,19 @@ void VARGS QCC_PR_ParseWarning (int type, char *error, ...)
va_list argptr;
char string[1024];
if (qccwarningdisabled[type])
if (type < ERR_PARSEERRORS && qccwarningdisabled[type])
return;
va_start (argptr,error);
QC_vsnprintf (string,sizeof(string)-1, error,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);
}
@ -2383,12 +2389,18 @@ char pr_parm_names[MAX_PARMS+MAX_EXTRA_PARMS][MAX_NAME];
char pr_parm_names[MAX_PARMS][MAX_NAME];
#endif
pbool recursivefunctiontype;
QCC_type_t *QCC_PR_NewType (char *name, int basictype);
//expects a ( to have already been parsed.
QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
{
QCC_type_t *ftype, *ptype, *nptype;
char *name;
int definenames = !recursivefunctiontype;
recursivefunctiontype++;
ftype = QCC_PR_NewType(type_function->name, ev_function);
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, ")"))
{
name = QCC_PR_ParseName ();
if (definenames)
strcpy (pr_parm_names[ftype->num_parms], name);
}
else
else if (definenames)
strcpy (pr_parm_names[ftype->num_parms], "");
ftype->num_parms++;
} while (QCC_PR_Check (","));
QCC_PR_Expect (")");
}
recursivefunctiontype--;
if (newtype)
return ftype;
return QCC_PR_FindType (ftype);