MISRA Discussion Forums

Full Version: macro contains unaceptable items misra c 2004 19.4
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.