I have a bunch of executables written in C that are statically analyzed with Polyspace Code Prover and Bug Finder. Both tools flag my main()
functions for violation of MISRA's Guideline 8.4, with the following message:
"A compatible declaration shall be visible when an object or function with external linkage is defined. Function 'main' has no visible compatible prototype at definition."
Forward declaring main()
seems to solve it, but that is very "weird" for me and it introduces problems when documenting the project with Doxygen.
Here's the function:
int main(int argument_counter, char const *arg_vector[])
also as you can see, we couldn't use the traditional argc
and argv[]
parameter names because they were too similar to some variables it found on the external headers, which is also superweird in my opinion.
Is this a code problem or is there something wrong with the tools configuration?