Avoid inline of functions with missing return statement
This commit is contained in:
parent
6981b28a64
commit
9adcbd2706
|
@ -124,6 +124,7 @@ static const uint64 DTF_FUNC_THIS = (1ULL << 47);
|
|||
static const uint64 DTF_VAR_ALIASING = (1ULL << 48);
|
||||
static const uint64 DTF_FPARAM_UNUSED = (1ULL << 49);
|
||||
static const uint64 DTF_DEPRECATED = (1ULL << 50);
|
||||
static const uint64 DTF_FUNC_NO_RETURN = (1ULL << 51);
|
||||
|
||||
|
||||
class Declaration;
|
||||
|
|
|
@ -170,7 +170,8 @@ void GlobalAnalyzer::AutoInline(void)
|
|||
!(f->mFlags & DTF_FUNC_VARIABLE) &&
|
||||
!((f->mFlags & DTF_FUNC_ASSEMBLER) && !(f->mFlags & DTF_REQUEST_INLINE)) &&
|
||||
!(f->mFlags & DTF_INTRINSIC) &&
|
||||
!(f->mFlags & DTF_FUNC_RECURSIVE))
|
||||
!(f->mFlags & DTF_FUNC_RECURSIVE) &&
|
||||
!(f->mFlags & DTF_FUNC_NO_RETURN))
|
||||
{
|
||||
int nparams = 0;
|
||||
Declaration* dec = f->mBase->mParams;
|
||||
|
@ -619,6 +620,8 @@ void GlobalAnalyzer::AnalyzeProcedure(Expression* cexp, Expression* exp, Declara
|
|||
|
||||
dec->mFlags |= DTF_ANALYZED;
|
||||
dec->mFlags |= DTF_FUNC_INTRSAVE;
|
||||
if (dec->mBase->mBase && dec->mBase->mBase->mType != DT_TYPE_VOID)
|
||||
dec->mFlags |= DTF_FUNC_NO_RETURN;
|
||||
|
||||
if (dec->mFlags & DTF_INTERRUPT)
|
||||
dec->mFlags |= DTF_FUNC_INTRCALLED;
|
||||
|
@ -1027,6 +1030,8 @@ Declaration * GlobalAnalyzer::Analyze(Expression* exp, Declaration* procDec, boo
|
|||
AnalyzeProcedure(exp, procDec->mBase->mBase->mCopyConstructor->mValue, procDec->mBase->mBase->mCopyConstructor);
|
||||
RegisterCall(procDec, procDec->mBase->mBase->mCopyConstructor);
|
||||
}
|
||||
|
||||
procDec->mFlags &= ~DTF_FUNC_NO_RETURN;
|
||||
}
|
||||
break;
|
||||
case EX_SEQUENCE:
|
||||
|
|
|
@ -1534,6 +1534,18 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateInline(Declaration* pro
|
|||
|
||||
if (pdec)
|
||||
{
|
||||
if (pdec->mBase->mType == DT_TYPE_POINTER && vr.mType->mType == DT_TYPE_INTEGER)
|
||||
{
|
||||
Expression* er = texp;
|
||||
while (er && er->mType == EX_COMMA)
|
||||
er = er->mRight;
|
||||
if (er && er->mType == EX_CONSTANT && er->mDecValue->mType == DT_CONST_INTEGER && er->mDecValue->mInteger == 0)
|
||||
{
|
||||
mErrors->Error(exp->mLocation, EWARN_NUMERIC_0_USED_AS_NULLPTR, "Numeric 0 used for nullptr");
|
||||
vr = CoerceType(proc, texp, block, inlineMapper, vr, pdec->mBase);
|
||||
}
|
||||
}
|
||||
|
||||
if (!pdec->mBase->CanAssign(vr.mType))
|
||||
{
|
||||
pdec->mBase->CanAssign(vr.mType);
|
||||
|
|
Loading…
Reference in New Issue