On Wed, Dec 04, 2013 at 06:30:37PM +0000, Joseph S. Myers wrote:
> On Wed, 4 Dec 2013, Marek Polacek wrote:
> 
> > I can, the question is whether we want that.  Anyway, this is version
> > which looks for the gnu_inline attribute.
> 
> If anything, I'd think it should apply to all inline functions.  The point 
> of this warning is that non-static functions should be declared in header 
> files, separate from their definition outside a header file, and inline 
> functions in general are expected to be defined directly in a header file, 
> so making a separate declaration redundant.

In that case, I'll apply this one after one more regtest.  Thanks.

2013-12-04  Marek Polacek  <pola...@redhat.com>

        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.

--- gcc/c/c-decl.c.mp3  2013-12-04 17:11:43.063878926 +0100
+++ gcc/c/c-decl.c      2013-12-04 19:33:00.581512253 +0100
@@ -7974,7 +7974,8 @@ start_function (struct c_declspecs *decl
           && 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
--- gcc/testsuite/gcc.dg/pr54113.c.mp3  2013-12-04 17:52:45.671288940 +0100
+++ gcc/testsuite/gcc.dg/pr54113.c      2013-12-04 18:48:31.012682675 +0100
@@ -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);

        Marek

Reply via email to