re PR c/63877 (- -Wmissing-declarations produces false alarms for C99 inline functions)
authorMarek Polacek <polacek@redhat.com>
Tue, 25 Nov 2014 08:28:45 +0000 (08:28 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 25 Nov 2014 08:28:45 +0000 (08:28 +0000)
PR c/63877
* c-decl.c (start_function): Disable -Wmissing-declarations warning
for inline functions.

* gcc.dg/pr63877.c: New test.

From-SVN: r218039

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr63877.c [new file with mode: 0644]

index 79d41830ee161c914d891173693c3fa27278bebc..e2a96309c7b6f3fbe67ca9dd6142fecd57e1efec 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c/63877
+       * c-decl.c (start_function): Disable -Wmissing-declarations warning
+       for inline functions.
+
 2014-11-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/63764
index 9288e2c1e8ca5b5781c35ed11915b18cfab27bc5..6413e6f8f35cdbc71518c0183aef3f8d50019490 100644 (file)
@@ -8353,7 +8353,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
   else if (warn_missing_declarations
           && TREE_PUBLIC (decl1)
           && old_decl == 0
-          && !MAIN_NAME_P (DECL_NAME (decl1)))
+          && !MAIN_NAME_P (DECL_NAME (decl1))
+          && !DECL_DECLARED_INLINE_P (decl1))
     warning_at (loc, OPT_Wmissing_declarations,
                "no previous declaration for %qD",
                decl1);
index 147674e67ee9b0316cd2310bb92a18f5df458704..4a8d7cd3cea0507244161e9d6f246c393f2091cd 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c/63877
+       * gcc.dg/pr63877.c: New test.
+
 2014-11-25  Markus Trippelsdorf  <markus@trippelsdorf.de>
 
        PR ipa/64059
diff --git a/gcc/testsuite/gcc.dg/pr63877.c b/gcc/testsuite/gcc.dg/pr63877.c
new file mode 100644 (file)
index 0000000..5969b39
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-Wmissing-declarations" } */
+
+inline int foo (void) { return 42; } /* { dg-bogus "no previous declaration" } */
+extern int foo (void);