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
This commit is contained in:
parent
022dcc4605
commit
46cfb1010d
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
|
@ -14224,15 +14224,16 @@ finish_function (flags)
|
|||
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. */
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
|
||||
X::x()
|
||||
{ // ERROR -
|
||||
} // WARNING - no return
|
||||
}
|
||||
|
||||
X::~x()
|
||||
{ // ERROR -
|
||||
|
|
Loading…
Reference in New Issue