-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations

Ian Lance Taylor iant@google.com
Tue Mar 6 08:12:00 GMT 2007


"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



More information about the Gcc-help mailing list