Rule 8.9 - 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.9 (/showthread.php?tid=1154) |
Rule 8.9 - anuj1085 - 18-02-2015 Below is my query: # file1 a.c includes a # file 2 a.h ================================ #file2 a.h contains following code snippet ------------------------------------------------------------- extern int eix; static int siz; eix and siz are not referenced from anywhere i.e. they are unused. So should the violation for this rule should be reported on these variables as well or the violation shoudl only be reported if the variable is used somewhere in the code. Re: Rule 8.9 - misra-c - 13-03-2015 These declarations do not violate rule 8.9, assuming that there are no other files in the system. If the header file is included in other files, the following violations may occur. static int siz; Rule 8.9 is violated for each file that "siz" is used in only one function. and Rule 5.9 is violated if the header file is included in more than one file. extern int eix; Rule 8.7 is violated if "eix" is used in only one file. and Rule 8.9 is violated if used in only one function in that file. It is assumed that the code has been written so that no other MISRA rules have been violated. |