This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Killing "no return statement in function returning non-void"


Hi,
currently we fail bootstrap with -O3 because of this warning comming out
of function of style
int blah()
{
  abort ();
}
that is probably not what we want.  The warning is currently enabled
only on inline functions and since cfg inliner rewrite the usual CFG
based warning is executed too, so I think this warning is completely
redundant.  What would you think of removing it and updating testsuite
accordingly for the new warning?

Honza

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.663
diff -c -3 -p -r1.663 c-decl.c
*** c-decl.c	18 Jun 2005 15:07:26 -0000	1.663
--- c-decl.c	19 Jun 2005 16:16:28 -0000
*************** finish_function (void)
*** 6502,6525 ****
  
    finish_fname_decls ();
  
-   /* Complain if there's just no return statement.  */
-   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 are no-return.  */
-       && !current_function_returns_abnormally
-       /* Don't warn for main().  */
-       && !MAIN_NAME_P (DECL_NAME (fndecl))
-       /* Or if they didn't actually specify a return type.  */
-       && !C_FUNCTION_IMPLICIT_INT (fndecl)
-       /* Normally, with -Wreturn-type, flow will complain.  Unless we're an
- 	 inline function, as we might never be compiled separately.  */
-       && DECL_INLINE (fndecl))
-     {
-       warning (0, "no return statement in function returning non-void");
-       TREE_NO_WARNING (fndecl) = 1;
-     }
- 
    /* With just -Wextra, complain only if function returns both with
       and without a value.  */
    if (extra_warnings
--- 6502,6507 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]