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
* [Bug c/63877] - -Wmissing-declarations produces false alarms for C99 inline functions
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 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-14 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-11-14
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Target Milestone|--- |5.0
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/63877] - -Wmissing-declarations produces false alarms for C99 inline functions
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
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-25 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Tue Nov 25 08:28:45 2014
New Revision: 218039
URL: https://gcc.gnu.org/viewcvs?rev=218039&root=gcc&view=rev
Log:
PR c/63877
* c-decl.c (start_function): Disable -Wmissing-declarations warning
for inline functions.
* gcc.dg/pr63877.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr63877.c
Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-decl.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/63877] - -Wmissing-declarations produces false alarms for C99 inline functions
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
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-25 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk.
^ 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).