]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/54113 (-Wmissing-prototypes produces false alarms for C99 inline functions)
authorMarek Polacek <polacek@redhat.com>
Wed, 4 Dec 2013 21:15:31 +0000 (21:15 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 4 Dec 2013 21:15:31 +0000 (21:15 +0000)
PR c/54113
c/
* c-decl.c (start_function): Don't warn for missing prototype for
inline functions.
testsuite/
* gcc.dg/pr54113.c: New test.

From-SVN: r205680

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

index b97e65ec2494eadd2354db0a0e25d2b53a03f91b..0603852fe866871200a66cff94564898d26fc281 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-04  Marek Polacek  <polacek@redhat.com>
+
+       PR c/54113
+       * c-decl.c (start_function): Don't warn for missing prototype for
+       inline functions.
+
 2013-12-03  Marek Polacek  <polacek@redhat.com>
 
        PR c/59351
index 3ebc002560eb0f65cfa22245dca8acee18ef61c1..3dbe9cbe5967d86dfa7fbceda398ea92de16033e 100644 (file)
@@ -7974,7 +7974,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
           && old_decl != error_mark_node
           && TREE_PUBLIC (decl1)
           && !MAIN_NAME_P (DECL_NAME (decl1))
-          && C_DECL_ISNT_PROTOTYPE (old_decl))
+          && C_DECL_ISNT_PROTOTYPE (old_decl)
+          && !DECL_DECLARED_INLINE_P (decl1))
     warning_at (loc, OPT_Wmissing_prototypes,
                "no previous prototype for %qD", decl1);
   /* Optionally warn of any def with no previous prototype
index b2331560b24fb991f41d9aa5c0adeafff2b15dc3..f05612efb7240b3d0fc1d76bfeb653b93818b2de 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-04  Marek Polacek  <polacek@redhat.com>
+
+       PR c/54113
+       * gcc.dg/pr54113.c: New test.
+
 2013-12-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/59268
diff --git a/gcc/testsuite/gcc.dg/pr54113.c b/gcc/testsuite/gcc.dg/pr54113.c
new file mode 100644 (file)
index 0000000..4c68099
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-Wmissing-prototypes" } */
+
+inline int foo (void) { return 42; } /* { dg-bogus "no previous prototype" } */
+extern int foo(void);