FTEQCC was having issues with initialising variables from other constants when using -Fautoproto.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5846 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-05-09 13:02:09 +00:00
parent 90597c9fbb
commit 1f6f0979bc
1 changed files with 7 additions and 1 deletions

View File

@ -5290,7 +5290,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
}
if (!pr_scope)
QCC_PR_ParseError(ERR_BADEXTENSION, "Unable to generate statements at global scope.\n");
QCC_PR_ParseError(ERR_BADEXTENSION, "Unable to generate statements at global scope.");
if (op->type_c == &type_void || op->associative==ASSOC_RIGHT || op->type_c == NULL)
{
@ -17390,6 +17390,12 @@ QCC_sref_t QCC_PR_ParseDefaultInitialiser(QCC_type_t *type)
QCC_sref_t ref = QCC_PR_Expression(TOP_PRIORITY, EXPR_DISALLOW_COMMA);
if (!ref.sym->constant)
QCC_PR_ParseError(0, "Default value not a constant\n");
if (!ref.sym->initialized)
{
if (autoprototype)
return nullsref;
QCC_PR_ParseError(0, "Default value not initialized yet\n");
}
return QCC_EvaluateCast(ref, type, true);
}