/* >>>------------------------------------------------------------ * * File: rule_5.2.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 5.2 (Required): * Identifiers in an inner scope shall not use the same name as an * identifier in an outer scope, and therefore hide that identifier. * * Implemented by messages: * 2547 This declaration of tag '%s' hides a more global * declaration. * * 3334 This declaration of '%s' hides a more global * declaration. * * <<<------------------------------------------------------------ */ /* PRQA S 2983,3203,3205 ++ */ #include "misra.h" #include "m2cmex.h" S16 obj_0502a = 0; static void test_0502a( void ); static S16 test_0502b( S16 obj_0502a ); static S16 test_0502c( void ); struct stag { S16 a; S16 b; }; extern S16 test_0502( void ) { struct stag /* MISRA Violation */ { S16 x; S16 y; } sl; S16 ret = obj_0502a; sl.x = ret; test_0502a(); ret = ret + test_0502b( 1 ); if (ret > 0) { S16 ret = sl.x; /* MISRA Violation */ ret = test_0502b( ret ); } ret = test_0502c(); return ret; } static void test_0502a( void ) { S16 obj_0502a = 0; /* MISRA Violation */ return; } static S16 test_0502b( S16 obj_0502a ) /* MISRA Violation */ { return obj_0502a; } static S16 test_0502c( void ) { return obj_0502a + 1; }