statement with -Wreturn-type.
* cp/decl.c (finish_function): Only warn about missing return
statement with -Wreturn-type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50132
138bc75d-0d04-0410-961f-
82ee72b054a4
+2002-02-25 Jason Merrill <jason@redhat.com>
+
+ * c-decl.c (finish_function): Only warn about missing return
+ statement with -Wreturn-type.
+
Don Feb 28 11:24:30 CET 2002 Jan Hubicka <jh@suse.cz>
* cfgrtl.c (purge_dead_edges): Fix handling of EH edges.
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
&& !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. */
+2002-02-28 Jason Merrill <jason@redhat.com>
+
+ * decl.c (finish_function): Only warn about missing return
+ statement with -Wreturn-type.
+
2002-02-28 Neil Booth <neil@daikokuya.demon.co.uk>
* class.c (build_clone): Update.
DECL_UNINLINABLE (fndecl) = 1;
/* Complain if there's just no return statement. */
- if (!processing_template_decl
+ if (warn_return_type
+ && !processing_template_decl
&& TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
&& !current_function_returns_value && !current_function_returns_null
- && !DECL_NAME (DECL_RESULT (fndecl))
/* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally
- /* If we have -Wreturn-type, let flow complain. Unless we're an
+ && !DECL_NAME (DECL_RESULT (fndecl))
+ /* 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. */
X::x()
{ // ERROR -
-} // WARNING - no return
+}
X::~x()
{ // ERROR -