[previous] MISRA C:2012  Rule-21.2:  (Required) [next] A reserved identifier or macro name shall not be declared

Amplification:

See the Amplification for Rule-21.1 for a description of the relevant identifiers and macro names.

Example Code:


#pragma PRQA_MESSAGES_OFF 2983,2984

#include "misra.h"
#include "m3cmex.h"


static float32_t sqrt( float32_t d );           /* 4604 */
static int16_t   _rule_2102a( void );           /*      */

enum { EOF = -1 };                              /* 4602 */
enum { cos = 55 };                              /* 4607 */
enum tm { t1, t2, t3 };                         /* 4608 */

typedef int FILE;                               /* 4605 */
typedef signed int sin;                         /* 4606 */


extern int16_t rule_2102( void )
{
   float32_t  f;
   FILE       r;
   sin        s = 5;

   f = sqrt( 1.44F );
   r = _rule_2102a();
   r = r + s;


   return r;
}

static float32_t sqrt( float32_t d )            /* 4603 */
{
   return( d );
}

static int16_t _rule_2102a( void )              /* 0602 */
{
   return 1;
}


QAC messages that encompass this guideline:

0602 [U] The identifier '%s' is reserved for use by the library.
4602 The identifier '%1s' is declared as a macro in '<%2s>'.
4603 The object/function '%1s'is being defined with the same name as an ordinary identifier defined in '<%2s>'.
4604 The object/function '%1s' is being declared with the same name as an ordinary identifier defined in '<%2s>'.
4605 The typedef '%1s' is also defined in '<%2s>'.
4606 The typedef '%1s' has the same name as another ordinary identifier in '<%2s>'.
4607 The enum constant '%1s' has the same name as another ordinary identifier in '<%2s>'.
4608 The tag '%1s' is also defined in '<%2s>'.


Related rules:

Rule-1.3 There shall be no occurrence of undefined or critical unspecified behaviour



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents