I have declared static global variable in my .c
file as below. I am observing this issue for few of the static variable not all static variable. For some static variable it is not raising any warnings.
static uint8 EL_adv = 0;
I got below MISRA warning:
"Could define variable 'EL_adv' at block scope [MISRA 2012 Rule 8.9, advisory] | pclint 9003"
If I remove static then I am getting error as below.
uint8 EL_adv = 0;
"external symbol 'EL_adv' defined without a prior declaration [MISRA 2012 Rule 8.4, required] | pclint 9075"
I am using in code which looks something as below, I will get value of the variable in fun1 & will use the value in fun2 and fun3.
void EL_ReadAll(void)
{
EL_adv = getValue();
}
void get_my1_EL_Adv()
{
my1EL_Adv = EL_adv;
}
void get_my2_EL_Adv()
{
my2EL_Adv = EL_adv;
}