aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-02-28 08:30:04 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-02-28 08:30:04 -0500
commit46cfb1010def3669407095b58a1ef83ad90acf62 (patch)
treead97c2c9c6937f818499e1e71ba0ae8c21869572 /gcc/c-decl.c
parent022dcc46051ffd0114ac3382cc7e50928f17d995 (diff)
downloadgcc-46cfb1010def3669407095b58a1ef83ad90acf62.zip
gcc-46cfb1010def3669407095b58a1ef83ad90acf62.tar.gz
gcc-46cfb1010def3669407095b58a1ef83ad90acf62.tar.bz2
c-decl.c (finish_function): Only warn about missing return statement with -Wreturn-type.
* c-decl.c (finish_function): Only warn about missing return statement with -Wreturn-type. * cp/decl.c (finish_function): Only warn about missing return statement with -Wreturn-type. From-SVN: r50132
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 21ff5ee..f465875 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -6809,7 +6809,8 @@ finish_function (nested)
finish_stmt_tree (&DECL_SAVED_TREE (fndecl));
/* Complain if there's just no return statement. */
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) != VOID_TYPE
+ if (warn_return_type
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) != VOID_TYPE
&& !current_function_returns_value && !current_function_returns_null
/* Don't complain if we abort. */
&& !current_function_returns_abnormally
@@ -6817,9 +6818,9 @@ finish_function (nested)
&& !MAIN_NAME_P (DECL_NAME (fndecl))
/* Or if they didn't actually specify a return type. */
&& !C_FUNCTION_IMPLICIT_INT (fndecl)
- /* If we have -Wreturn-type, let flow complain. Unless we're an
+ /* Normally, with -Wreturn-type, flow will complain. Unless we're an
inline function, as we might never be compiled separately. */
- && (!warn_return_type || DECL_INLINE (fndecl)))
+ && DECL_INLINE (fndecl))
warning ("no return statement in function returning non-void");
/* Clear out memory we no longer need. */