Does #define CAL_TP const volatile violate Rule 19.4 - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.19 Preprocessing Directives (https://forum.misra.org.uk/forumdisplay.php?fid=43) +---- Thread: Does #define CAL_TP const volatile violate Rule 19.4 (/showthread.php?tid=1342) |
Does #define CAL_TP const volatile violate Rule 19.4 - steveudog - 27-04-2017 Is it permissible to have more than one attribute in the define? My code is auto-generated using Simulink. It contains the define: #define CAL_TP const volatile Our MISRA checker determined this to be a violation of Rule 19.4, but some of my colleagues dispute this. They think it is a flaw in the checker. Is this a violation? Re: Does #define CAL_TP const volatile violate Rule 19.4 - misra-c - 14-06-2017 Rule 19.4 only permits a macro that expands to a single "type qualifier". i.e. "const" or "volatile". Therefore the above example violates rule 19.4 However, it should be noted that this rule was relaxed in MISRA C:2012 and the above example would not violate MISRA C:2012 rules. If you are continuing to use MISRA-C:2004, then the justification for a deviation for this code could include that this Rule has been relaxed for MISRA C:2012. |