/* >>>------------------------------------------------------------ * * File: rule_6.2.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 6.2 (Required): * Signed and unsigned char type shall be used only for the * storage and use of numeric values. * * Implemented by messages: * 4413 An expression of 'essentially character' type (%1s) is * being converted to signed type, '%2s' on assignment. * * 4414 An expression of 'essentially character' type (%1s) is * being converted to unsigned type, '%2s' on assignment. * * <<<------------------------------------------------------------ */ /* PRQA S 2982,2984,3205 ++ */ #include "misra.h" #include "m2cmex.h" static S8 test_0602a(void); static U8 test_0602b(void); extern S16 test_0602( void ) { u8a = 1u; /* Correct usage of unsigned char for numeric data */ s8a = 0; /* Correct usage of signed char for numeric data */ pca = 'u'; /* Correct usage of plain char for character data */ s8a = pca; /* MISRA Violation */ u8a = pca; /* MISRA Violation */ s8a = pca + 1; /* MISRA Violation */ u8a = pca + 1; /* MISRA Violation */ s8a = test_0602a(); u8a = test_0602b(); return 0; } static S8 test_0602a(void) { return pca; /* MISRA Violation */ } static U8 test_0602b(void) { return pca; /* MISRA Violation */ }