This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations
- From: Ian Lance Taylor <iant at google dot com>
- To: <john dot fisher at nec dot com dot au>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: 05 Mar 2007 21:38:27 -0800
- Subject: Re: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations
- References: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au>
"John Fisher" <john.fisher@nec.com.au> writes:
> Is it necessary to specify all 4 of these warnings to get the maximum amount
> of warnings in C code?
Probably not.
> I would expect that -Wmissing-prototypes implies -Wmissing-declarations
> since I understand
> prototype to mean exactly "new-style function declaration".
-Wmissing-prototypes warns about
void f ();
void f (int i) { }
(i.e., there is no previous declaration with a prototype).
-Wmissing-declarations normally warns about
void f (int i) { }
(i.e., there is no previous declaration at all) which is a subset of
-Wmissing-prototypes.
I can't think of any case where -Wmissing-declarations will give a
warning but -Wmissing-prototypes will not. There is what appears to
be such a case in the compiler source code, but I don't see any way to
trigger it with a valid program.
Ian