12-05-2014, 08:51 AM
Hi guys,
I am encountering some problems trying to make MISRA 6.1 compliant my source code,
expecially using enumeration.
From one side, in the header file I declare:
typedef enum { FALLING_EDGE = 0x0, RISING_EDGE } t_EdgePolarity;
and from the other side, in the code I declare:
emios_error_t EMIOS_PIN_Config(t_PIO_CHANNELS _channel,
t_BusSelect _bsl,
t_EdgeSelection _edgesel,
t_EdgePolarity _edgepol,
t_ActiveFilter _filter)
{
... ... ... ... ... ...
/* Do somthing */
switch (_edgepol)
case FALLING_EDGE:
/* Do somthing */
break;
case RISING_EDGE:
/* Do somthing */
break;
default:
/* Do somthing */
break;
... ... ... ... ...
}
At compile time, green hills 5.1.6 compiler gives back this error message:
MISRA 2004 Rule 6.1:
only assignment and equality operators may be used on plain char
operand
switch (_edgepol)
^
It is only an example, but I have same error with all the enumeration used in
the code.
Any suggestions?
Thank you in advance,
Andrea Mocci, embedded SW developer @ Akhela s.r.l.
I am encountering some problems trying to make MISRA 6.1 compliant my source code,
expecially using enumeration.
From one side, in the header file I declare:
typedef enum { FALLING_EDGE = 0x0, RISING_EDGE } t_EdgePolarity;
and from the other side, in the code I declare:
emios_error_t EMIOS_PIN_Config(t_PIO_CHANNELS _channel,
t_BusSelect _bsl,
t_EdgeSelection _edgesel,
t_EdgePolarity _edgepol,
t_ActiveFilter _filter)
{
... ... ... ... ... ...
/* Do somthing */
switch (_edgepol)
case FALLING_EDGE:
/* Do somthing */
break;
case RISING_EDGE:
/* Do somthing */
break;
default:
/* Do somthing */
break;
... ... ... ... ...
}
At compile time, green hills 5.1.6 compiler gives back this error message:
MISRA 2004 Rule 6.1:
only assignment and equality operators may be used on plain char
operand
switch (_edgepol)
^
It is only an example, but I have same error with all the enumeration used in
the code.
Any suggestions?
Thank you in advance,
Andrea Mocci, embedded SW developer @ Akhela s.r.l.
<t></t>