Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shall Rule 21.1 apply to the both paths of conditional preprocessing
#1
Hi there,
Rule 21.1 doesn't mention anything about preprocessing, so given the following code
Code:
#define ABC 345

#ifdef ABC
#define _XYZ 0xFFFFFFFF    //defect1
#else
#define _XYZ 0xF0000000  //defect2
#endif

shall we report both the above defects or only the one(defec1) in the true path?

thanks
<t></t>
Reply
#2
The MISRA C Glossary defines Code as:

"Code consists of everything within a translation unit that is not excluded by conditional compilation"

As such, reporting violations in active code is the requirement.

Reporting violations in inactive code is not always appropriate, as that code may not compile-able due to other considerations.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)