FUNC-unprototyped-all
In this section:
Synopsis
Functions are declared with an empty () parameter list that does not form a valid prototype.
Enabled by default
No
Severity/Certainty
Medium/High

Full description
Functions are declared with an empty () parameter list that does not form a valid prototype. Functions must be prototyped before use. This check is identical to MISRAC2004-16.5, MISRAC2012-Rule-8.2_a.
Coding standards
- CERT DCL20-C
Always specify void even if a function accepts no arguments
- MISRA C:2004 16.5
(Required) Functions with no parameters shall be declared and defined with the parameter list void.
- MISRA C:2012 Rule-8.2
(Required) Function types shall be in prototype form with named parameters
Code examples
The following code example fails the check and will give a warning:
void func(); /* not a valid prototype in C */
void func2(void)
{
func();
}
The following code example passes the check and will not give a warning about this issue:
void func(void);
void func2(void)
{
func();
}