MATLAB: Does Polyspace say the code violates MISRA 8.1 when I have a prototype for the function

Polyspace Code ProverPolyspace Code Prover Server

I have a function with the following prototype.
 
void foo();
Later on in my code I call it as follows.
foo();
When I run Polyspace to check for MISRA violations it says I violated MISRA AC AGC rule 8.1: "Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call.". The function "foo" has a visible prototype where it is called, so why is this a violation?

Best Answer

In the C programming language there is a distinction between functions declared as "void foo()" and "void foo(void)". The first is a function that takes an unknown number of arguments of unknown type, while the latter takes exactly zero arguments. MISRA rule 8.1 requires that functions that take zero arguments use the "void foo(void)" syntax. Changing the function prototype accordingly will resolve the violation Polyspace is reporting.
Note, the above distinction does not exist in C++ where "void foo()" and "void foo(void)" are equivalent.