public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54113] New: -Wmissing-prototypes cries wolf for C99 inline functions
@ 2012-07-28 13:47 eggert at gnu dot org
  2012-08-14  4:08 ` [Bug c/54113] " eggert at gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eggert at gnu dot org @ 2012-07-28 13:47 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: eggert@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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-04 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-28 13:47 [Bug c/54113] New: -Wmissing-prototypes cries wolf for C99 inline functions eggert at gnu dot org
2012-08-14  4:08 ` [Bug c/54113] " eggert at gnu dot org
2013-12-04 17:00 ` [Bug c/54113] -Wmissing-prototypes produces false alarms " mpolacek at gcc dot gnu.org
2013-12-04 21:15 ` mpolacek at gcc dot gnu.org
2013-12-04 21:18 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).