/* >>>------------------------------------------------------------ * * File: rule_11.5.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 11.5 (Required): * A cast shall not be performed that removes any const or * volatile qualification from the type addressed by a pointer. * * Implemented by messages: * 311 Dangerous pointer cast results in loss of const * qualification. * * 312 Dangerous pointer cast results in loss of volatile * qualification. * * <<<------------------------------------------------------------ */ /* PRQA S 2982,2983,3203 ++ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1105( void ) { U16 x; U16 * const cpi = &x; /* const pointer */ U16 * const * pcpi = 0; /* pointer to const pointer */ const U16 * * ppci = 0; /* pointer to pointer to const */ U16 * * ppi; /* pointer ot pointer */ const U16 * pci = 0; /* pointer to const */ volatile U16 * pvi = 0; /* pointer to volatile */ U16 * pi; pi = cpi; /* Compliant - no conversion no cast required */ pi = ( U16 * )pci; /* MISRA Violation */ pi = ( U16 * )pvi; /* MISRA Violation */ ppi = ( U16 * * )pcpi; /* MISRA Violation */ ppi = ( U16 * * )ppci; /* MISRA Violation */ return 0; }