aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-04-29 03:24:27 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-04-29 03:24:27 +0000
commita833faa5999c552d5e87b36691732e7f338c5ce1 (patch)
tree37410dac5d69f16d8ad0eb350980071c1f87900a /gcc/tree-inline.c
parent3e1be8c1b1da6e8a423260c65cdaaec64fa37ea7 (diff)
downloadgcc-a833faa5999c552d5e87b36691732e7f338c5ce1.zip
gcc-a833faa5999c552d5e87b36691732e7f338c5ce1.tar.gz
gcc-a833faa5999c552d5e87b36691732e7f338c5ce1.tar.bz2
re PR c++/10180 (gcc fails to warn about non-inlined function)
PR c++/10180 * tree-inline.c (expand_call_inline): Call push_srcloc when encountering EXPR_WITH_FILE_LOCATION. Honor warn_inline. PR c++/10180 * g++.dg/warn/Winline-1.C: New test. From-SVN: r66202
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 22298a0..3a8adc5 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1139,6 +1139,19 @@ expand_call_inline (tp, walk_subtrees, data)
abort ();
#endif /* INLINER_FOR_JAVA */
}
+ else if (TREE_CODE (t) == EXPR_WITH_FILE_LOCATION)
+ {
+ /* We're walking the subtree directly. */
+ *walk_subtrees = 0;
+ /* Update the source position. */
+ push_srcloc (EXPR_WFL_FILENAME (t), EXPR_WFL_LINENO (t));
+ walk_tree (&EXPR_WFL_NODE (t), expand_call_inline, data,
+ id->tree_pruner);
+ /* Restore the original source position. */
+ pop_srcloc ();
+
+ return NULL_TREE;
+ }
if (TYPE_P (t))
/* Because types were not copied in copy_body, CALL_EXPRs beneath
@@ -1173,7 +1186,14 @@ expand_call_inline (tp, walk_subtrees, data)
if ((!flag_unit_at_a_time || !DECL_SAVED_TREE (fn)
|| !cgraph_global_info (fn)->inline_once)
&& !inlinable_function_p (fn, id, 0))
- return NULL_TREE;
+ {
+ if (warn_inline && DECL_INLINE (fn))
+ {
+ warning_with_decl (fn, "inlining failed in call to `%s'");
+ warning ("called from here");
+ }
+ return NULL_TREE;
+ }
if (! (*lang_hooks.tree_inlining.start_inlining) (fn))
return NULL_TREE;