MISRA Discussion Forums
macro contains unaceptable items misra c 2004 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: macro contains unaceptable items misra c 2004 19.4 (/showthread.php?tid=973)



macro contains unaceptable items misra c 2004 19.4 - manojkdi - 31-07-2013

Example

#define MACRO_2 1(this macro is defined in some other file)

#define MACRO_1 MACRO_2

this statement is causing the warning in "macro contains unacceptable items misra c 2004 19.4".Is this warning valid? Is it really a invalid macro definition?


Re: macro contains unaceptable items misra c 2004 19.4 - misra-c - 11-09-2013

This example has previously caused much debate within the team!

Under a strict interpretation of the Rules, then MACRO_2 probably should be in braces... but that is clearly unnecessary, probably unintentional, and serves no purpose.

For MISRA C:2012 the ambiguity is removed, and there is no requirement to add the additional parentheses.