/* >>>------------------------------------------------------------ * * File: rule_19.4.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 19.4 (Required): * C macros shall only expand to a braced initialiser, a constant, * a string literal, a parenthesised expression, a type qualifier, a * storage class specifier, or a do-while-zero construct. * * Implemented by messages: * 3409 The replacement list of function-like macro '%s' is not * enclosed in (). * * 3411 Macro defined with unbalanced brackets, parentheses or * braces. * * 3412 Macro defines an unrecognized code-fragment. * * 3413 Macro definition could be replaced by a typedef. * * 3431 Macro defines an operator, a punctuator or a control * statement keyword. * * 3452 The replacement list of object-like macro '%s' is not * enclosed in (). * * 3458 Macro defines a braced code statement block. * * 3460 Macro defines a type specifier keyword. * * 3461 Macro defines a storage-class specifier/type qualifier * sequence. * * <<<------------------------------------------------------------ */ /* PRQA S 3429 ++ */ #include "misra.h" #include "m2cmex.h" #define PI 3.14159f /* OK */ #define PLUS2( X ) ( ( X ) + 2 ) /* OK */ #define XT extern /* OK */ #define MAX( a, b ) ( ( a )>( b ) ? ( a ) : ( b ) ) /* OK */ #define CONST const /* OK */ #define IN1(x) {x, 0.0, 1.0} /* OK */ #define L switch /* MISRA Violation */ #define M -5 /* MISRA Violation */ #define ADD(A, B) (A) + (B) /* MISRA Violation */ #define ANIF if ( /* MISRA Violation */ #define ANOIF if /* MISRA Violation */ #define FNC1(x) {if ((x) < 0) (x) = 10;} /* MISRA Violation */ #define TY01 static const /* MISRA Violation */ #define TYPE1 struct /* MISRA Violation */ #define TYPE2 unsigned int /* MISRA Violation */ #define CONSTANT ( 100 ) #define CONSTANT2 CONSTANT #define FUNC( X ) ( ( X ) + 2 ) #define FUNC2 FUNC( 10 ) extern S16 test_1904( void ) { return 1; }