public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63877] New: - -Wmissing-declarations produces false alarms for C99 inline functions
@ 2014-11-14 19:05 eggert at gnu dot org
  2014-11-14 19:23 ` [Bug c/63877] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eggert at gnu dot org @ 2014-11-14 19:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877

            Bug ID: 63877
           Summary: - -Wmissing-declarations produces false alarms for C99
                    inline functions
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org

This is a followup to PR c/54113, which was about -Wmissing-prototypes.  This
followup bug report is the same, except it is about -Wmissing-declarations.

-Wmissing-declarations produces false alarms for C99-style
inline functions.  We can use the same example as for PR c/54113.
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-declarations foo.c

outputs:

  In file included from foo.c:1:0:
  foo.h:1:14: warning: no previous declaration for 'square'
[-Wmissing-declarations]
   inline float square(float x) {return x*x;}
              ^
  foo.h:2:14: warning: no previous declaration for 'cube'
[-Wmissing-declarations]
   inline float cube(float x) {return x*x*x;}
              ^

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

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


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

end of thread, other threads:[~2014-11-25  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 19:05 [Bug c/63877] New: - -Wmissing-declarations produces false alarms for C99 inline functions eggert at gnu dot org
2014-11-14 19:23 ` [Bug c/63877] " mpolacek at gcc dot gnu.org
2014-11-25  8:29 ` mpolacek at gcc dot gnu.org
2014-11-25  8:30 ` 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).