From a6f3addd0bf743047a29a98235ecde07b41e9790 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 7 Feb 2002 07:22:10 -0500 Subject: c-decl.c (finish_function): Warn about a non-void function with no return statement and no abnormal exit. * c-decl.c (finish_function): Warn about a non-void function with no return statement and no abnormal exit. (current_function_returns_abnormally): New variable. (start_function): Clear it. (struct c_language_function): Add returns_abnormally. (push_c_function_context): Save it. (pop_c_function_context): Restore it. (builtin_function): Set TREE_THIS_VOLATILE on return fns. (grokdeclarator): Set C_FUNCTION_IMPLICIT_INT on functions without an explicit return type. * c-tree.h: Declare current_function_returns_abnormally. (C_FUNCTION_IMPLICIT_INT): New macro. * c-typeck.c (build_function_call): Set it. (c_expand_return): Set current_function_returns_value even if the value is erroneous. From-SVN: r49577 --- gcc/testsuite/gcc.dg/Wreturn-type.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Wreturn-type.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/Wreturn-type.c b/gcc/testsuite/gcc.dg/Wreturn-type.c new file mode 100644 index 0000000..a122e52 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wreturn-type.c @@ -0,0 +1,5 @@ +/* PR c++/4872 */ +/* { dg-do compile } */ +/* { dg-options "-Wreturn-type" } */ + +static inline int f() {} /* { dg-warning "return" "missing return" } */ -- cgit v1.1