OSDN Git Service

PR c++/17115
authorgiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2004 08:36:28 +0000 (08:36 +0000)
committergiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2004 08:36:28 +0000 (08:36 +0000)
* tree-inline.c (expand_call_inline): Do not warn for functions
marked with attribute noinline.

PR c++/17115
* g++.dg/warn/Winline-4.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88678 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b00fad9..7ac6b4a 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-07  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/17115
+       * tree-inline.c (expand_call_inline): Do not warn for functions
+       marked with attribute noinline.
+
 2004-10-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR target/17862
 2004-10-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR target/17862
index 4858269..1087adb 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-07  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/17115
+       * g++.dg/warn/Winline-4.C: New test.
+
 2004-10-07  Christian Ehrhardt  <ehrhardt@mathematik.uni-ulm.de>
 
        * gcc.c-torture/compile/20041007-1.c: New test.
 2004-10-07  Christian Ehrhardt  <ehrhardt@mathematik.uni-ulm.de>
 
        * gcc.c-torture/compile/20041007-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/warn/Winline-4.C b/gcc/testsuite/g++.dg/warn/Winline-4.C
new file mode 100644 (file)
index 0000000..188ab5a
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O2 -Winline" }
+// Origin: <markus at oberhumer dot com>
+// PR 17115: We should not emit -Winline warning for functions marked with
+//  noinline
+
+struct Foo {
+  __attribute__((noinline)) int a(int r) { return r & 1; }
+  virtual __attribute__((noinline)) int b(int r) { return r & 1; }
+  static  __attribute__((noinline)) int c(int r) { return r & 1; }
+};
+
+int bar(int r) {
+  Foo f;
+  int k = 1; k &= f.a(r); k &= f.b(r); k &= f.a(r);
+  return k;
+}
index 38fa455..0583eb4 100644 (file)
@@ -1475,7 +1475,8 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data)
        }
       else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
               && !DECL_IN_SYSTEM_HEADER (fn)
        }
       else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
               && !DECL_IN_SYSTEM_HEADER (fn)
-              && strlen (reason))
+              && strlen (reason)
+              && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn)))
        {
          warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
          warning ("called from here");
        {
          warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
          warning ("called from here");