http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113

             Bug #: 54113
           Summary: -Wmissing-prototypes cries wolf for C99 inline
                    functions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: egg...@gnu.org


-Wmissing-prototypes produces false alarms for C99-style
inline functions.  Here's a simple example, taken from
<http://www.drdobbs.com/the-new-c-inline-functions/184401540>.
Suppose foo.h contains this:

  inline float square(float x) {return x*x;}
  inline float cube(float x) {return x*x*x;}

and foo.c contains this:

  #include "foo.h"
  extern float square(float x);
  extern float cube(float x);

Then the command:

  gcc -c -Wmissing-prototypes foo.c

outputs:

  In file included from foo.c:1:0:
  foo.h:1:14: warning: no previous prototype for 'square'
[-Wmissing-prototypes]
  foo.h:2:14: warning: no previous prototype for 'cube' [-Wmissing-prototypes]

The diagnostics should not be output, as this is the normal
way to use inline functions in C.

The simplest way to work around the problem is to avoid
the use of -Wmissing-prototypes, but that disables the
diagnostic for non-inline functions, where it's useful.

To fix this, I suggest that the diagnostic be suppressed
for inline functions, at least for C99 mode.

Reply via email to