++/-- prefix operators were evaluating the entire right-hand side (including greater-thans!)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@430 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-16 04:43:12 +00:00
parent b7b07796fe
commit 939eb98abf
1 changed files with 16 additions and 2 deletions

View File

@ -3639,9 +3639,11 @@ QCC_def_t *QCC_PR_Term (void)
if (QCC_PR_Check("++")) //supposedly. I'm unsure weather it works properly.
{
qcc_usefulstatement=true;
e = QCC_PR_Expression (TOP_PRIORITY);
e = QCC_PR_Term ();
if (e->constant)
QCC_PR_ParseWarning(WARN_ASSIGNMENTTOCONSTANT, "Assignment to constant %s", e->name);
if (e->temp)
QCC_PR_ParseWarning(WARN_ASSIGNMENTTOCONSTANT, "Hey! That's a temp! ++ operators cannot work on temps!");
switch (e->type->type)
{
case ev_integer:
@ -3659,9 +3661,11 @@ QCC_def_t *QCC_PR_Term (void)
else if (QCC_PR_Check("--"))
{
qcc_usefulstatement=true;
e = QCC_PR_Expression (TOP_PRIORITY);
e = QCC_PR_Term ();
if (e->constant)
QCC_PR_ParseWarning(WARN_ASSIGNMENTTOCONSTANT, "Assignment to constant %s", e->name);
if (e->temp)
QCC_PR_ParseWarning(WARN_ASSIGNMENTTOCONSTANT, "Hey! That's a temp! -- operators cannot work on temps!");
switch (e->type->type)
{
case ev_integer:
@ -5805,6 +5809,16 @@ void QCC_WriteAsmFunction(QCC_def_t *sc, unsigned int firststatement, gofs_t fir
fprintf(asmfile, ",\t%i", statements[i].c);
}
}
else
{
if (pr_opcodes[statements[i].op].type_c != &type_void)
{
if (pr_opcodes[statements[i].op].type_c)
fprintf(asmfile, ",\t%s", QCC_VarAtOffset(statements[i].c, (*pr_opcodes[statements[i].op].type_c)->size));
else
fprintf(asmfile, ",\t%i", statements[i].c);
}
}
}
fprintf(asmfile, ";\n");
}