This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Wmissing-{prototypes,declarations}


Hi :)

Firstly, I was curious to know what the difference between 
-Wmissing-prototypes and -Wmissing-declarations was. Is there any difference 
for C, or are only C++ and/or other languages affected? (I don't know C++.) A 
small test with GCC 3.1 seems to indicate that they both apply to functions, 
neither applies to global variables, neither applies to static functions or 
variables, and the only difference is the word used in the text of the 
warning:

[entheh@bnd25 tests]$ cat decl.c
static void static_no_prototype(void) { }
static int static_no_declaration;
void no_prototype(void) { }
int no_declaration;
[entheh@bnd25 tests]$ gcc -c -Wmissing-prototypes decl.c
decl.c:3: warning: no previous prototype for `no_prototype'
[entheh@bnd25 tests]$ gcc -c -Wmissing-declarations decl.c
decl.c:3: warning: no previous declaration for `no_prototype'

I did a web search and nothing came up on the subject - am I the first to 
wonder about this?

Secondly, I'm disappointed that there doesn't seem to be a flag that enables 
a similar warning for global non-static variables. Have I missed anything? If 
not, are there any plans to add such a flag in the future?

Thanks

Ben


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]