re PR c++/10888 (inlining failure for allocate in ~vector())
authorMark Mitchell <mark@codesourcery.com>
Fri, 20 Jun 2003 19:55:29 +0000 (19:55 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 20 Jun 2003 19:55:29 +0000 (19:55 +0000)
PR c++/10888
* tree-inline.c (expand_call_inline): Do not warn about failing to
inline functions declared in system headers.
* doc/invoke.texi (-Winline): Expand on documentation.

PR c++/10888
* g++.dg/warn/Winline-3.C: New test.

From-SVN: r68281

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Winline-3.C [new file with mode: 0644]
gcc/tree-inline.c

index 7954f0622354731964cc84d604a6682a602b1667..3f405374acaf08ca2acfc76f04d4889c3746b931 100644 (file)
@@ -1,3 +1,10 @@
+2003-06-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10888
+       * tree-inline.c (expand_call_inline): Do not warn about failing to
+       inline functions declared in system headers.
+       * doc/invoke.texi (-Winline): Expand on documentation.
+
 2003-06-20  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/alpha.c (alpha_file_start): Disable
index 5256e66d8ff4e28de25e035ac28a9a2bf59db617..33b16e86627b8bc830318f87ee379228ac6cee28 100644 (file)
@@ -2811,6 +2811,15 @@ code is to provide behavior which is selectable at compile-time.
 @item -Winline
 @opindex Winline
 Warn if a function can not be inlined and it was declared as inline.
+Even with this option, the compiler will not warn about failures to
+inline functions declared in system headers.  
+
+The compiler uses a variety of heuristics to determine whether or not
+to inline a function.  For example, the compiler takes into account
+the size of the function being inlined and the the amount of inlining
+that has already been done in the current function.  Therefore,
+seemingly insignificant changes in the source program can cause the
+warnings produced by @option{-Winline} to appear or disappear.
 
 @item -Wno-invalid-offsetof @r{(C++ only)}
 @opindex Wno-invalid-offsetof
index 25dc0dce75bd7090087dccc8a652cc2d96e521d6..a0b977744f6539aa171ec1030d6267d0fabdf634 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10888
+       * g++.dg/warn/Winline-3.C: New test. 
+
 2003-06-20  Mark Mitchell  <mark@codesourcery.com>
 
        * lib/target-supports.exp (check_alias_available): Make the test
diff --git a/gcc/testsuite/g++.dg/warn/Winline-3.C b/gcc/testsuite/g++.dg/warn/Winline-3.C
new file mode 100644 (file)
index 0000000..1c226d1
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-options "-Winline -O" }
+
+#include <vector>
+
+using namespace std;
+
+int main(void)
+{
+  vector<int> v(10);
+}
index c0d36106cf1d80283f7223cea1e5af4cbc282978..88bf4d9bc020ebeecbbdb7f62b6627153d6d75ae 100644 (file)
@@ -1201,7 +1201,8 @@ expand_call_inline (tp, walk_subtrees, data)
        || !cgraph_global_info (fn)->inline_once)
       && !inlinable_function_p (fn, id, 0))
     {
-      if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn))
+      if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn)
+         && !DECL_IN_SYSTEM_HEADER (fn))
        {
          warning_with_decl (fn, "inlining failed in call to `%s'");
          warning ("called from here");