/* >>>------------------------------------------------------------ * * File: rule_2.1.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 2.1 (Required): * Assembly language shall be encapsulated and isolated. * * Implemented by message: * 3006 This function contains a mixture of in-line assembler * statements and C statements. * * <<<------------------------------------------------------------ */ /********************************************************************* INLINE ASSEMBLER EXTENSIONS 1. The assembler extensions option (-ex asm) is accessed through the compiler personality in the GUI. This option enables QAC to parse (and ignore) the following constructs: a. A function defined with the keywords asm or __asm in its prototype will be ignored. (Message 1006) b. Assembler code blocks introduced by the keywords asm and __asm will be ignored. (Message 1006) c. In-line assembler statements of the form asm(...); will be ignored. (Message 1006) d. Blocks of statements enclosed between the directives #asm and #endasm will be ignored. (Message 1003) 2. Assembler statements can also be ignored by QAC if they are located between two #pragma directives which have been declared as a #pragma block using the -skippragma option (analyser personality). *********************************************************************/ /* PRQA S 2982 ++ */ #include "misra.h" #include "m2cmex.h" static asm S16 fn_a( void ); /* MISRA Violation - Rule 1.1 */ static S16 asm fn_b( void ); /* MISRA Violation - Rule 1.1 */ static S16 __asm fn_c( void ); /* MISRA Violation - Rule 1.1 */ static S16 fn_d( const S16 a ); extern S16 test_0201( void ) { S16 r; r = fn_a(); r = fn_b(); r = fn_c(); r = fn_d( 1 ); return r; } static asm S16 fn_a( void ) /* MISRA Violation - Rule 1.1 */ { All statements will be ignored in the body of this function. } static S16 asm fn_b( void ) /* MISRA Violation - Rule 1.1 */ { All statements will be ignored in the body of this function. } static S16 __asm fn_c( void ) /* MISRA Violation - Rule 1.1 */ { All statements will be ignored in the body of this function. } static S16 fn_d( const S16 a ) /* MISRA Violation */ { const S16 r = a + 1; asm { .. Assembler ...} /* MISRA Violation - Rule 1.1 */ __asm { ... Assembler ... } /* MISRA Violation - Rule 1.1 */ asm( Assembler Statements ); /* MISRA Violation - Rule 1.1 */ #asm /* MISRA Violation - Rule 1.1 */ Any assembler statements will be ignored in this block #endasm /* MISRA Violation - Rule 1.1 */ return r; }