From be2ba2cb5fa12af89e8534f1571f0987670b7403 Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Sun, 1 Nov 2009 16:52:10 +0000 Subject: [PATCH] Check for function not returning a vlue when it should git-svn-id: http://picoc.googlecode.com/svn/trunk@366 21eae674-98b7-11dd-bd71-f92a316d2d60 --- expression.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/expression.c b/expression.c index dbb7d12..65092c4 100644 --- a/expression.c +++ b/expression.c @@ -1320,8 +1320,8 @@ void ExpressionParseFunctionCall(struct ParseState *Parser, struct ExpressionSta if (ParseStatement(&FuncParser) != ParseResultOk) ProgramFail(&FuncParser, "function body expected"); - if (FuncValue->Val->FuncDef.ReturnType != ReturnValue->Typ) - ProgramFail(&FuncParser, "return value is %t instead of %t", ReturnValue->Typ, FuncValue->Val->FuncDef.ReturnType); + if (FuncValue->Val->FuncDef.ReturnType != &VoidType && FuncParser.Mode == RunModeRun) + ProgramFail(&FuncParser, "no value returned from a function returning %t", FuncValue->Val->FuncDef.ReturnType); VariableStackFramePop(Parser); }