Rule 8.4: Prototype for function with internal linkage required? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.8 Declarations and defnitions (https://forum.misra.org.uk/forumdisplay.php?fid=163) +---- Thread: Rule 8.4: Prototype for function with internal linkage required? (/showthread.php?tid=1212) |
Rule 8.4: Prototype for function with internal linkage required? - aletomm - 04-11-2015 Does MISRA-C 2012 mandate prototypes for functions with internal linkage? While MISRA-C 2012 rule 8.4 is very explicit about prototypes for functions with external linkage, we have not found a corresponding rule for internally linked functions. Our static analysis tool takes the simplistic approach that prototypes are required in any case due to MISRA-C 2004 8.1 rule. I like to challenge its reasoning. Thanks. Re: Rule 8.4: Prototype for function with internal linkage required? - misra-c - 11-12-2015 MISRA C:2012 requires both function declarations and definitions with internal linkage to be in prototype form (rule 8.2). However MISRA C:2012 does not require there to be a separate declaration in addition to the definition for functions with internal linkage. For example: Code: static void fn ( int32_t i32 ); /* Declaration required by MISRA-C:2004 rule 8.1, In summary:
|