In C, function declarations can be prototype or non-prototype declarations. For example, consider the following minimal program:
int foo (); /* non-prototype declaration */
int bar (void); /* prototype declaration */
int main (int argc, char **argv)
{
return 0;
}
Although in C99 non-prototype declarations are obsolete, I cannot get GCC to complain about them. For example, compiling the above program with GCC and all errors enabled just succeeds:
$ gcc -std=c99 -pedantic -Werror -Wall test.c
$
Is there any way to persuade GCC to emit warnings for function declarations that aren't prototypes?
(Question inspired by an answer by Keith Thompson.)