forked from fte/fteqw
1
0
Fork 0

Add some warnings if the user redefines a constant.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@166 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-07 18:27:08 +00:00
parent 9c6b591e51
commit b8b14dbf8f
1 changed files with 11 additions and 2 deletions

View File

@ -1426,7 +1426,10 @@ pbool QCC_PR_UndefineName(char *name)
CompilerConstant_t *c;
c = Hash_Get(&compconstantstable, name);
if (!c)
{
QCC_PR_ParseWarning(WARN_NOTDEFINED, "Precompiler constant %s was not defined", name);
return false;
}
Hash_Remove(&compconstantstable, name);
return true;
@ -1475,7 +1478,12 @@ CompilerConstant_t *QCC_PR_DefineName(char *name)
if (strlen(name) >= MAXCONSTANTLENGTH || !*name)
QCC_PR_ParseError(ERR_CONSTANTTOOLONG, "Compiler constant name length is too long or short");
QCC_PR_UndefineName(name);
cnst = Hash_Get(&compconstantstable, name);
if (cnst )
{
QCC_PR_ParseWarning(WARN_DUPLICATEDEFINITION, "Duplicate definition for Precompiler constant %s", name);
Hash_Remove(&compconstantstable, name);
}
cnst = qccHunkAlloc(sizeof(CompilerConstant_t));
@ -2671,4 +2679,5 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
}
#endif
#endif