macro contains unaceptable items misra c 2004 19.4

6.19 Preprocessing Directives

Moderators: misra-c, david ward

Post Reply
manojkdi
Posts: 1
Joined: Thu Jul 25, 2013 7:57 am
Company: Texas Instruments

macro contains unaceptable items misra c 2004 19.4

Post by manojkdi » Wed Jul 31, 2013 12:35 pm

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?

misra-c
Posts: 572
Joined: Thu Jan 05, 2006 1:11 pm

Re: macro contains unaceptable items misra c 2004 19.4

Post by misra-c » Wed Sep 11, 2013 12:03 pm

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.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.19 Preprocessing Directives”