aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2005-01-21 19:05:23 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2005-01-21 19:05:23 +0000
commit089efaa4a16ff50c6c5b37e9f7add71f20c18f1b (patch)
tree29a38b973974253486c46f8b085f055eee2e1e15 /gcc/tree-inline.c
parentd284eb28eb6f3ef8c3f27e7428b8cdc8e51d965f (diff)
downloadgcc-089efaa4a16ff50c6c5b37e9f7add71f20c18f1b.zip
gcc-089efaa4a16ff50c6c5b37e9f7add71f20c18f1b.tar.gz
gcc-089efaa4a16ff50c6c5b37e9f7add71f20c18f1b.tar.bz2
re PR tree-optimization/13000 ([unit-at-a-time] Using -O2 cannot detect missing return statement in a function)
PR tree-optimization/13000 * tree-inline.c: Include "tree-flow.h". (expand_call_inline): If warn_return_type, warn if non-void inline function falls through. * tree-cfg.c (execute_warn_function_return): Don't warn about control reaching end if TREE_NO_WARNING is set. Set TREE_NO_WARNING. * gimple-low.c (block_may_fallthru): Don't assume that SWITCH_EXPR has been lowered. * gimplify.c (shortcut_cond_expr): Don't emit a jump over the else branch if we don't need one. * c-typeck.c: Include "tree-flow.h" (c_finish_bc_stmt): Don't add a goto if the current statement list doesn't fall through to the current point. From-SVN: r94024
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 247c687..b46276a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */
#include "cgraph.h"
#include "intl.h"
#include "tree-mudflap.h"
+#include "tree-flow.h"
#include "function.h"
#include "diagnostic.h"
#include "debug.h"
@@ -1607,9 +1608,22 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
function itself. */
{
struct cgraph_node *old_node = id->current_node;
+ tree copy;
id->current_node = edge->callee;
- append_to_statement_list (copy_body (id), &BIND_EXPR_BODY (expr));
+ copy = copy_body (id);
+
+ if (warn_return_type
+ && !TREE_NO_WARNING (fn)
+ && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn)))
+ && block_may_fallthru (copy))
+ {
+ warning ("control may reach end of non-void function %qD being inlined",
+ fn);
+ TREE_NO_WARNING (fn) = 1;
+ }
+
+ append_to_statement_list (copy, &BIND_EXPR_BODY (expr));
id->current_node = old_node;
}
inlined_body = &BIND_EXPR_BODY (expr);