aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-06-20 19:05:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2007-06-25 15:51:43 -0400
commitf78588abcebac0462764e5c8a3c91fa7a13bad45 (patch)
treead9a707cf2ac3e5ac730b33887361ff842f97919 /evaluate.c
parent[PATCH] in case of compound literal we want to delay examining type (diff)
downloadsparse-f78588abcebac0462764e5c8a3c91fa7a13bad45.tar.gz
sparse-f78588abcebac0462764e5c8a3c91fa7a13bad45.tar.bz2
sparse-f78588abcebac0462764e5c8a3c91fa7a13bad45.zip
[PATCH] warn on return <void expression>;
conditional on -Wreturn-void Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/evaluate.c b/evaluate.c
index e3b4940..07ebf0c 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2790,6 +2790,8 @@ static struct symbol *evaluate_return_expression(struct statement *stmt)
if (!fntype || fntype == &void_ctype) {
if (expr && expr->ctype != &void_ctype)
expression_error(expr, "return expression in %s function", fntype?"void":"typeless");
+ if (expr && Wreturn_void)
+ warning(stmt->pos, "returning void-valued expression");
return NULL;
}