Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-8.2_a

In this section:
Synopsis

(Required) Function types shall be in prototype form with named parameters.

Enabled by default

Yes

Severity/Certainty

Medium/High

mediumhigh.png
Full description

There are functions declared with an empty () parameter list that does not form a valid prototype. This check is identical to FUNC-unprototyped-all, MISRAC2004-16.5.

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();
}