]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/10929 (-Winline warns about functions for which no definition is visible)
authorJason Merrill <jason@redhat.com>
Tue, 17 Jun 2003 23:00:16 +0000 (19:00 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 17 Jun 2003 23:00:16 +0000 (19:00 -0400)
        PR c++/10929
        * tree-inline.c (expand_call_inline): Don't warn about failing to
        inline a function which was made inline by -finline-functions.
        * cp/decl.c (grokfndecl): Don't mark a function inline for
        -finline-functions if it isn't defined.

From-SVN: r68122

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/warn/Winline-2.C [new file with mode: 0644]
gcc/tree-inline.c

index e57272e7c0d71711e7972677147b26139416b9a7..48c7c7c5e2caf96646f4b481e6748bdca32584fd 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/10929
+       * tree-inline.c (expand_call_inline): Don't warn about failing to
+       inline a function which was made inline by -finline-functions.
+
 2003-06-17  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/h8300/h8300-protos.h: Update to ISO C.
index 7e8bbc7b1d6d4d2ff25cadad3a494b0f548a552b..8c333fe8b45519deffe40908da90e795dd6a845f 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/10929
+       * decl.c (grokfndecl): Don't mark a function inline for
+       -finline-functions if it isn't defined.
+
 2003-06-17  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/10712
index d76133a0f4aefd9e98881881a7a76f6f87bea079..4ec5c3176ce2415e6a013482c627647409ba8688 100644 (file)
@@ -8883,7 +8883,7 @@ grokfndecl (tree ctype,
      the user explicitly asks us to, all functions.  */
   if (DECL_DECLARED_INLINE_P (decl))
     DECL_INLINE (decl) = 1;
-  if (flag_inline_trees == 2 && !DECL_INLINE (decl))
+  if (flag_inline_trees == 2 && !DECL_INLINE (decl) && funcdef_flag)
     {
       DID_INLINE_FUNC (decl) = 1;
       DECL_INLINE (decl) = 1;
diff --git a/gcc/testsuite/g++.dg/warn/Winline-2.C b/gcc/testsuite/g++.dg/warn/Winline-2.C
new file mode 100644 (file)
index 0000000..69af343
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/10929
+// { dg-options "-Winline -O3" }
+
+int foo ();
+int bar () { return foo (); }
index dd50ca1d63130af88aa81dbfa90422e1ee8cbbf7..c0d36106cf1d80283f7223cea1e5af4cbc282978 100644 (file)
@@ -1201,7 +1201,7 @@ 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))
+      if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn))
        {
          warning_with_decl (fn, "inlining failed in call to `%s'");
          warning ("called from here");
This page took 0.11686 seconds and 5 git commands to generate.