Consider this code:
int function()
{
int a = 1 ;
int b = helper(&a);
return b ;
}
int main()
{
function();
return 0 ;
}
This piece of code is compiled into object code without problems using gcc, even though a function called a helper has not been declared. I know that the linker should catch this, but I saw obscure errors that were resolved after including the correct headers (containing function declarations), despite the linker and compiler not generating any errors.
There are a few gcc warnings that seem to be related to each other, but don't actually achieve what I want: -Wmissing-prototypes, -Wmissing-declarations and -Wstrict-prototypes. Unfortunately, these warnings are limited to missing prototypes when global functions are defined , I'm interested in warnings about missing prototypes when global functions are specified .
Can anyone suggest alternatives ?, thanks.
source
share