<<

MISRA ++ 2008 Mapping to CodeSonar®

Relationship CodeSonar Class CodeSonar Class Category ID Category Name Type (category Mnemonic Name to class) A project shall not contain MisraC++2008:0-1-1 LANG.STRUCT.UC Unreachable Call closely mapped unreachable code. A project shall not contain Unreachable MisraC++2008:0-1-1 LANG.STRUCT.UC closely mapped unreachable code. Computation A project shall not contain Unreachable MisraC++2008:0-1-1 LANG.STRUCT.UC closely mapped unreachable code. Conditional A project shall not contain Unreachable Control MisraC++2008:0-1-1 LANG.STRUCT.UC closely mapped unreachable code. Flow A project shall not contain Unreachable Data MisraC++2008:0-1-1 LANG.STRUCT.UC closely mapped unreachable code. Flow A project shall not contain MisraC++2008:0-1-3 LANG.STRUCT.UUVAR Unused Variable closely mapped unused variables. A project shall not contain MisraC++2008:0-1-5 LANG.STRUCT.UUTYPE Unused Type closely mapped unused type declarations. A project shall not contain instances of non-volatile MisraC++2008:0-1-6 variables being given values LANG.STRUCT.UUVAL Unused Value closely mapped that are never subsequently used. The value returned by a function having a non-void Ignored Return MisraC++2008:0-1-7 that is not an LANG.FUNCS.IRV closely mapped Value overloaded operator shall always be used. All functions with void return Function Call Has MisraC++2008:0-1-8 type shall have external side MISC.NOEFFECT closely mapped No Effect effect(s). Function Call Has MisraC++2008:0-1-9 There shall be no dead code. MISC.NOEFFECT closely mapped No Effect MisraC++2008:0-1-9 There shall be no dead code. LANG.STRUCT.UUVAL Unused Value closely mapped

MisraC++2008:0-1-9 There shall be no dead code. LANG.STRUCT.UA Useless Assignment closely mapped There shall be no unused parameters (named or MisraC++2008:0-1-11 LANG.STRUCT.UUPARAM Unused Parameter closely mapped unnamed) in non-virtual functions. There shall be no unused parameters (named or unnamed) in the of MisraC++2008:0-1-12 LANG.STRUCT.UUPARAM Unused Parameter closely mapped parameters for a virtual function and all the functions that override it. An object shall not be assigned Overlapping Memory MisraC++2008:0-2-1 MISC.MEM.OR closely mapped to an overlapping object. Regions

If a function generates error Ignored Return MisraC++2008:0-3-2 information, then that error LANG.FUNCS.IRV closely mapped Value information shall be tested.

MisraC++2008:2-3-1 Trigraphs shall not be used. LANG.STRUCT.TRIGRAPH Trigraph closely mapped

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

The sequence /* shall LANG.COMM.NEST.CSTY MisraC++2008:2-7-1 not be used within a C-style /* in Comment closely mapped LE comment. Sections of code shall not be Commented-out MisraC++2008:2-7-2 "commented out" using C-style LANG.COMM.CODE closely mapped Code comments. Sections of code should not be Commented-out MisraC++2008:2-7-3 "commented out" using C++ LANG.COMM.CODE closely mapped Code comments. Typographically Different identifiers shall be MisraC++2008:2-10-1 LANG.ID.AMBIG Ambiguous closely mapped typographically unambiguous. Identifiers Identifiers declared in an inner Non-distinct shall not hide an MisraC++2008:2-10-2 LANG.ID.ND.NEST Identifiers: Nested closely mapped identifier declared in an outer Scope scope. A typedef name (including Non-unique MisraC++2008:2-10-3 qualification, if any) shall be a LANG.ID.NU.TYPE closely mapped Identifiers: Typedef unique identifier. A class, union or enum name Non-unique MisraC++2008:2-10-4 (including qualification, if any) LANG.ID.NU.TAG closely mapped Identifiers: Tag shall be a unique identifier.

The identifier name of a non- Non-unique member object or function with MisraC++2008:2-10-5 LANG.ID.NU.INT Identifiers: Internal closely mapped static storage duration should Name not be reused. If an identifier refers to a type, it Non-distinct shall not also refer to an object MisraC++2008:2-10-6 LANG.ID.ND.SS Identifiers: Same closely mapped or a function in the same Scope scope. Octal constants (other than zero) and octal escape MisraC++2008:2-13-2 LANG.TYPE.OC Octal Constant closely mapped sequences (other than "\0") shall not be used. A "U" suffix shall be applied to MisraC++2008:2-13-3 all octal or hexadecimal integer LANG.TYPE.MSUF Missing Literal Suffix closely mapped literals of unsigned type. Literal suffixes shall be upper Confusing Literal MisraC++2008:2-13-4 LANG.TYPE.CSUF closely mapped case. Suffix It shall be possible to include any header file in multiple Function Defined in MisraC++2008:3-1-1 translation units without LANG.STRUCT.DEF.FDH closely mapped Header File violating the One Definition Rule. It shall be possible to include any header file in multiple Object Defined in MisraC++2008:3-1-1 translation units without LANG.STRUCT.DEF.ODH closely mapped Header File violating the One Definition Rule. Functions shall not be declared LANG.STRUCT.DECL.FNE Nested Function MisraC++2008:3-1-2 closely mapped at block scope. ST Declaration

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

When an array is declared, its size shall either be stated LANG.STRUCT.DECL.EA Extern Array Without MisraC++2008:3-1-3 closely mapped explicitly or defined implicitly by WS Size initialization. All declarations of an object or Global Variable LANG.STRUCT.DECL.MG MisraC++2008:3-2-1 function shall have compatible Declared with closely mapped T types. Different Types All declarations of an object or Inconsistent MisraC++2008:3-2-1 function shall have compatible LANG.STRUCT.DECL.IF Function closely mapped types. Declarations All declarations of an object or Inconsistent Object MisraC++2008:3-2-1 function shall have compatible LANG.STRUCT.DECL.IO closely mapped Declarations types. The One Definition Rule shall LANG.STRUCT.DEF.NOEX Missing External MisraC++2008:3-2-2 closely mapped not be violated. T Definition The One Definition Rule shall LANG.STRUCT.DEF.MULT Multiple External MisraC++2008:3-2-2 closely mapped not be violated. IEXT Definitions A type, object or function that is used in multiple translation LANG.STRUCT.DECL.NO Missing External MisraC++2008:3-2-3 closely mapped units shall be declared in one EXT Declaration and only one file.

A type, object or function that is used in multiple translation Multiple Declarations MisraC++2008:3-2-3 LANG.STRUCT.DECL.MG closely mapped units shall be declared in one of a Global and only one file.

A type, object or function that is used in multiple translation LANG.STRUCT.DECL.MU Multiple External MisraC++2008:3-2-3 closely mapped units shall be declared in one LTIEXT Declarations and only one file. An identifier with external LANG.STRUCT.DEF.NOEX Missing External MisraC++2008:3-2-4 linkage shall have exactly one closely mapped T Definition definition. An identifier with external LANG.STRUCT.DEF.MULT Multiple External MisraC++2008:3-2-4 linkage shall have exactly one closely mapped IEXT Definitions definition. If a function has internal linkage then all re-declarations shall LANG.STRUCT.SCOPE.FI Scope Could Be File MisraC++2008:3-3-2 closely mapped include the static storage class LE Static specifier.

If a function has internal linkage then all re-declarations shall LANG.STRUCT.SCOPE.LO Scope Could Be MisraC++2008:3-3-2 closely mapped include the static storage class CAL Local Static specifier. An identifier declared to be an object or type shall be defined LANG.STRUCT.SCOPE.LO Scope Could Be MisraC++2008:3-4-1 closely mapped in a block that minimizes its CAL Local Static visibility.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

The types used for an object, a function return type, or a Global Variable function parameter shall be LANG.STRUCT.DECL.MG MisraC++2008:3-9-1 Declared with closely mapped token-for-token identical in all T Different Types declarations and re- declarations.

The types used for an object, a function return type, or a Inconsistent function parameter shall be MisraC++2008:3-9-1 LANG.STRUCT.DECL.IF Function closely mapped token-for-token identical in all Declarations declarations and re- declarations.

The types used for an object, a function return type, or a function parameter shall be Inconsistent Object MisraC++2008:3-9-1 LANG.STRUCT.DECL.IO closely mapped token-for-token identical in all Declarations declarations and re- declarations. typedefs that indicate size and should be used in Basic Numerical MisraC++2008:3-9-2 LANG.TYPE.BASIC closely mapped place of the basic numerical Type Used types.

Expressions with type bool shall not be used as operands to built-in operators other than the assignment operator = , the Inappropriate MisraC++2008:4-5-1 LANG.TYPE.IOT closely mapped logical operators && , || , ! , Operand Type the equality operators == and != , the unary & operator, and the conditional operator.

Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator [ ] , the Inappropriate MisraC++2008:4-5-2 assignment operator = , the LANG.TYPE.IOT closely mapped Operand Type equality operators == and != , the unary & operator, and the relational operators < , <= , > , >= .

Expressions with type (plain) char and wchar_t shall not be used as operands to built-in Inappropriate MisraC++2008:4-5-3 operators other than the LANG.TYPE.ICA closely mapped Character Arithmetic assignment operator = , the equality operators == and != , and the unary & operator.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

Expressions with type (plain) char and wchar_t shall not be used as operands to built-in Inappropriate MisraC++2008:4-5-3 operators other than the LANG.TYPE.IOT closely mapped Operand Type assignment operator = , the equality operators == and != , and the unary & operator.

A cvalue expression shall not Expression Value MisraC++2008:5-0-3 be implicitly converted to a LANG.TYPE.AWID Widened by closely mapped different underlying type. Assignment

A cvalue expression shall not Expression Value MisraC++2008:5-0-3 be implicitly converted to a LANG.TYPE.OWID Widened by Other closely mapped different underlying type. Operand

A cvalue expression shall not Inappropriate MisraC++2008:5-0-3 be implicitly converted to a LANG.TYPE.IAT closely mapped Assignment Type different underlying type.

A cvalue expression shall not Mismatched MisraC++2008:5-0-3 be implicitly converted to a LANG.TYPE.MOT closely mapped Operand Types different underlying type. An implicit integral conversion shall not change the Coercion Alters MisraC++2008:5-0-4 LANG.CAST.COERCE closely mapped signedness of the underlying Value type. Expression Value There shall be no implicit MisraC++2008:5-0-5 LANG.TYPE.AWID Widened by closely mapped floating-integral conversions. Assignment Expression Value There shall be no implicit MisraC++2008:5-0-5 LANG.TYPE.OWID Widened by Other closely mapped floating-integral conversions. Operand There shall be no implicit Inappropriate MisraC++2008:5-0-5 LANG.TYPE.IAT closely mapped floating-integral conversions. Assignment Type

There shall be no implicit Mismatched MisraC++2008:5-0-5 LANG.TYPE.MOT closely mapped floating-integral conversions. Operand Types An implicit integral or floating- point conversion shall not Coercion Alters MisraC++2008:5-0-6 LANG.CAST.COERCE closely mapped reduce the size of the Value underlying type. An implicit integral or floating- point conversion shall not Inappropriate MisraC++2008:5-0-6 LANG.TYPE.IAT closely mapped reduce the size of the Assignment Type underlying type. There shall be no explicit Inappropriate Cast MisraC++2008:5-0-7 floating-integral conversions of LANG.TYPE.ICTE closely mapped Type: Expression a cvalue expression. An explicit integral or floating- point conversion shall not Inappropriate Cast MisraC++2008:5-0-8 increase the size of the LANG.TYPE.ICTE closely mapped Type: Expression underlying type of a cvalue expression.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

An explicit integral conversion shall not change the MisraC++2008:5-0-9 LANG.CAST.VALUE Cast Alters Value closely mapped signedness of the underlying type of a cvalue expression.

If the bitwise operators ~ and << are applied to an operand with an underlying type of Risky Integer MisraC++2008:5-0-10 unsigned char or unsigned LANG.CAST.RIP closely mapped Promotion short, the result shall be immediately cast to the underlying type of the operand.

The plain char type shall only Inappropriate MisraC++2008:5-0-11 be used for the storage and LANG.TYPE.IAT closely mapped Assignment Type use of character values.

The plain char type shall only Inappropriate MisraC++2008:5-0-11 be used for the storage and LANG.TYPE.ICA closely mapped Character Arithmetic use of character values.

The plain char type shall only Inappropriate MisraC++2008:5-0-11 be used for the storage and LANG.TYPE.IOT closely mapped Operand Type use of character values.

The plain char type shall only Mismatched MisraC++2008:5-0-11 be used for the storage and LANG.TYPE.MOT closely mapped Operand Types use of character values. signed char and unsigned char type shall only be used for the Inappropriate MisraC++2008:5-0-12 LANG.TYPE.IAT closely mapped storage and use of numeric Assignment Type values. signed char and unsigned char type shall only be used for the Inappropriate MisraC++2008:5-0-12 LANG.TYPE.ICA closely mapped storage and use of numeric Character Arithmetic values. signed char and unsigned char type shall only be used for the Inappropriate MisraC++2008:5-0-12 LANG.TYPE.IOT closely mapped storage and use of numeric Operand Type values. signed char and unsigned char type shall only be used for the Mismatched MisraC++2008:5-0-12 LANG.TYPE.MOT closely mapped storage and use of numeric Operand Types values.

The condition of an if-statement Condition Is Not MisraC++2008:5-0-13 and the condition of an iteration- LANG.STRUCT.NBC closely mapped Boolean statement shall have type bool.

The first operand of a Inappropriate MisraC++2008:5-0-14 conditional-operator shall have LANG.TYPE.IOT closely mapped Operand Type type bool.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

A pointer operand and any pointer resulting from pointer MisraC++2008:5-0-16 arithmetic using that operand LANG.MEM.BO Buffer Overrun also related shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer MisraC++2008:5-0-16 arithmetic using that operand LANG.MEM.BU Buffer Underrun also related shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer Pointer Before MisraC++2008:5-0-16 arithmetic using that operand LANG.STRUCT.PBB also related Beginning of Object shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer Pointer Past End of MisraC++2008:5-0-16 arithmetic using that operand LANG.STRUCT.PPE also related Object shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer Tainted Buffer MisraC++2008:5-0-16 arithmetic using that operand LANG.MEM.TBA also related Access shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer MisraC++2008:5-0-16 arithmetic using that operand LANG.MEM.TO Type Overrun also related shall both address elements of the same array.

A pointer operand and any pointer resulting from pointer MisraC++2008:5-0-16 arithmetic using that operand LANG.MEM.TU Type Underrun also related shall both address elements of the same array.

Non-constant operands to a Inappropriate MisraC++2008:5-0-20 binary bitwise operator shall LANG.TYPE.IOT closely mapped Operand Type have the same underlying type.

Bitwise operators shall only be Inappropriate MisraC++2008:5-0-21 applied to operands of LANG.TYPE.IOT closely mapped Operand Type unsigned underlying type.

MisraC++2008:5-2-4 MisraC++2008:5-2-4 LANG.CAST.VALUE Cast Alters Value also related Dangerous Function MisraC++2008:5-2-4 MisraC++2008:5-2-4 LANG.CAST.FN also related Cast A cast shall not remove any const or volatile qualification Cast Removes const MisraC++2008:5-2-5 LANG.CAST.PC.CRCQ closely mapped from the type of a pointer or Qualifier reference.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

A cast shall not remove any const or volatile qualification Cast Removes MisraC++2008:5-2-5 LANG.CAST.PC.CRVQ closely mapped from the type of a pointer or volatile Qualifier reference. A cast shall not convert a pointer to a function to any Dangerous Function MisraC++2008:5-2-6 LANG.CAST.FN closely mapped other pointer type, including a Cast pointer to .

A cast shall not convert a pointer to a function to any LANG.STRUCT.FUNCPTR. MisraC++2008:5-2-6 also related other pointer type, including a CONVERT Conversion pointer to function type. An object with pointer type shall not be converted to an Cast: Object MisraC++2008:5-2-7 LANG.CAST.PC.OBJ closely mapped unrelated pointer type, either Pointers directly or indirectly. An object with pointer type shall not be converted to an Conversion from MisraC++2008:5-2-7 LANG.CAST.PC.FN2DATA closely mapped unrelated pointer type, either Function Pointer directly or indirectly. An object with pointer type shall not be converted to an Conversion: Pointer MisraC++2008:5-2-7 LANG.CAST.PC.INC closely mapped unrelated pointer type, either to Incomplete directly or indirectly. An object with pointer type shall not be converted to an Conversion: MisraC++2008:5-2-7 LANG.CAST.PC.INT closely mapped unrelated pointer type, either Pointer/Integer directly or indirectly. An object with pointer type shall Conversion: Void not be converted to an MisraC++2008:5-2-7 LANG.CAST.PC.PV Pointer to Object closely mapped unrelated pointer type, either Pointer directly or indirectly. An object with integer type or pointer to shall not be Conversion: MisraC++2008:5-2-8 LANG.CAST.PC.INT closely mapped converted to an object with Pointer/Integer pointer type. An object with integer type or Conversion: Void pointer to void type shall not be MisraC++2008:5-2-8 LANG.CAST.PC.PV Pointer to Object closely mapped converted to an object with Pointer pointer type. A cast should not convert a Conversion: MisraC++2008:5-2-9 LANG.CAST.PC.INT closely mapped pointer type to an integral type. Pointer/Integer

The increment ( ++ ) and Side Effects in decrement ( -- ) operators MisraC++2008:5-2-10 LANG.STRUCT.SE.DEC Expression with closely mapped should not be mixed with other Decrement operators in an expression.

The increment ( ++ ) and Side Effects in decrement ( -- ) operators MisraC++2008:5-2-10 LANG.STRUCT.SE.INC Expression with closely mapped should not be mixed with other Increment operators in an expression.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

Each operand of the ! operator, the logical && or the Inappropriate MisraC++2008:5-3-1 LANG.TYPE.IOT closely mapped logical || operators shall have Operand Type type bool. The unary minus operator shall not be applied to an expression Inappropriate MisraC++2008:5-3-2 LANG.TYPE.IOT closely mapped whose underlying type is Operand Type unsigned. Evaluation of the operand to the LANG.STRUCT.SE.SIZEO MisraC++2008:5-3-4 sizeof operator shall not contain Side Effects in sizeof closely mapped F side effects. The right hand operand of a shift operator shall lie between Negative Shift MisraC++2008:5-8-1 zero and one less than the LANG.ARITH.NEGSHIFT closely mapped Amount width in of the underlying type of the left hand operand.

The right hand operand of a shift operator shall lie between Shift Amount MisraC++2008:5-8-1 zero and one less than the LANG.ARITH.BIGSHIFT closely mapped Exceeds Width width in bits of the underlying type of the left hand operand.

The statement forming the body Body Is Not of a switch, while, do ... while or MisraC++2008:6-3-1 LANG.STRUCT.BNC Compound closely mapped for statement shall be a Statement compound statement.

An if ( condition ) construct shall be followed by a Body Is Not compound statement. The else MisraC++2008:6-4-1 LANG.STRUCT.BNC Compound closely mapped keyword shall be followed by Statement either a compound statement, or another if statement. All if ... else if constructs shall MisraC++2008:6-4-2 be terminated with an else LANG.STRUCT.NOELSE Missing Final else closely mapped clause. A switch statement shall be a Malformed switch MisraC++2008:6-4-3 LANG.STRUCT.SW.BAD closely mapped well-formed switch statement. Statement

An unconditional throw or break MisraC++2008:6-4-5 statement shall terminate every LANG.STRUCT.SW.MB Missing break closely mapped non-empty switch-clause. The final clause of a switch MisraC++2008:6-4-6 statement shall be the default- LANG.STRUCT.SW.MPD Misplaced default closely mapped clause. The final clause of a switch MisraC++2008:6-4-6 statement shall be the default- LANG.STRUCT.SW.MD Missing default closely mapped clause. The condition of a switch Boolean switch MisraC++2008:6-4-7 statement shall not have bool LANG.STRUCT.SW.BOOL closely mapped Expression type. Every switch statement shall Too Few Cases in MisraC++2008:6-4-8 LANG.STRUCT.SW.IF closely mapped have at least one case-clause. switch

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

A for loop shall contain a single Float-typed Loop MisraC++2008:6-5-1 loop-counter which shall not LANG.STRUCT.LOOP.FPC closely mapped Counter have floating type. The loop-counter shall not be LANG.STRUCT.LOOP.MFT Malformed for-loop MisraC++2008:6-5-3 modified within condition or closely mapped ERM Condition statement. The loop-counter shall not be LANG.STRUCT.LOOP.MFI Malformed for-loop MisraC++2008:6-5-3 modified within condition or closely mapped NIT Initialization statement. The loop-counter shall be modified by one of -- , ++ , - LANG.STRUCT.LOOP.MF Malformed for-loop MisraC++2008:6-5-4 =n , or +=n; where n remains closely mapped STEP Step constant for the duration of the loop. A loop-control-variable other than the loop-counter shall not LANG.STRUCT.LOOP.MFT Malformed for-loop MisraC++2008:6-5-5 closely mapped be modified within condition or ERM Condition expression.

A loop-control-variable other than the loop-counter shall not LANG.STRUCT.LOOP.MF Malformed for-loop MisraC++2008:6-5-5 closely mapped be modified within condition or STEP Step expression.

Any label referenced by a goto statement shall be declared in Label Not In MisraC++2008:6-6-1 LANG.STRUCT.GLABEL closely mapped the same block, or in a block Enclosing Block enclosing the goto statement.

The goto statement shall jump MisraC++2008:6-6-2 to a label declared later in the LANG.STRUCT.BGOTO Backwards goto closely mapped same function body. The continue statement shall LANG.STRUCT.CONTINU MisraC++2008:6-6-3 only be used within a well- Continue Statement closely mapped E formed for loop. For any iteration statement there shall be no more than one LANG.STRUCT.LOOP.MA Multiple Abnormal MisraC++2008:6-6-4 closely mapped break or goto statement used E Loop Exits for loop termination. A function shall have a single Misplaced Return MisraC++2008:6-6-5 point of exit at the end of the LANG.STRUCT.MISRS closely mapped Statement function. A function shall have a single Multiple Return MisraC++2008:6-6-5 point of exit at the end of the LANG.STRUCT.MULRS closely mapped Statements function. Assembly language shall be Mixed Assembly and MisraC++2008:7-4-3 LANG.ASM.MIXED closely mapped encapsulated and isolated. Code A function shall not return a reference or a pointer to an Return Pointer to MisraC++2008:7-5-1 automatic variable (including LANG.STRUCT.RPL closely mapped Local parameters), defined within the function.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

Functions should not call LANG.FUNCS.RECURSIO MisraC++2008:7-5-4 themselves, either directly or Recursion closely mapped N indirectly. The identifiers used for the Global Variable parameters in a re-declaration LANG.STRUCT.DECL.MG hierarchy MisraC++2008:8-4-2 Declared with of a function shall be identical T descendant Different Types to those in the declaration.

The identifiers used for the Inconsistent parameters in a re-declaration MisraC++2008:8-4-2 LANG.STRUCT.DECL.IF Function closely mapped of a function shall be identical Declarations to those in the declaration.

The identifiers used for the parameters in a re-declaration Inconsistent Object hierarchy MisraC++2008:8-4-2 LANG.STRUCT.DECL.IO of a function shall be identical Declarations descendant to those in the declaration.

All exit paths from a function with non-void return type shall Missing Return MisraC++2008:8-4-3 LANG.STRUCT.MRS closely mapped have an explicit statement with an expression. All variables shall have a MisraC++2008:8-5-1 defined value before they are LANG.MEM.UVAR Uninitialized Variable closely mapped used. Braces shall be used to indicate and match the Missing Braces in MisraC++2008:8-5-2 structure in the non-zero LANG.STRUCT.INIT.MBI closely mapped Initialization initialization of arrays and structures. In an enumerator list, the = construct shall not be used to Inconsistent LANG.STRUCT.INIT.ENU MisraC++2008:8-5-3 explicitly initialize members Enumerator closely mapped M other than the first, unless all Initialization items are explicitly initialized.

MisraC++2008:9-5-1 Unions shall not be used. LANG.TYPE.UNION closely mapped

Bit-fields shall be either bool Bit-field Signedness MisraC++2008:9-6-2 type or an explicitly unsigned or LANG.TYPE.BFSIGN closely mapped Not Explicit signed integral type.

Bit-fields shall be either bool Inappropriate Bit- MisraC++2008:9-6-2 type or an explicitly unsigned or LANG.TYPE.BFINT closely mapped field Type signed integral type. Bit-fields shall not have enum Bit-field Signedness MisraC++2008:9-6-3 LANG.TYPE.BFSIGN closely mapped type. Not Explicit Bit-fields shall not have enum Inappropriate Bit- MisraC++2008:9-6-3 LANG.TYPE.BFINT closely mapped type. field Type Named bit-fields with signed MisraC++2008:9-6-4 integer type shall have a length LANG.TYPE.BFSHORT Bit-field Too Short closely mapped of more than one bit.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

#include directives in a file shall only be preceded by Code Before MisraC++2008:16-0-1 LANG.PREPROC.CBI closely mapped preprocessor directives or #include comments. Macro Undefinition MisraC++2008:16-0-3 #undef shall not be used. LANG.PREPROC.RUNDEF closely mapped of Reserved Name MisraC++2008:16-0-3 #undef shall not be used. LANG.PREPROC.UNDEF Use of #undef closely mapped

Arguments to a function-like Preprocessing macro shall not contain tokens LANG.PREPROC.MACRO MisraC++2008:16-0-5 Directives in Macro closely mapped that look like preprocessing ARG Argument directives.

If the # token appears as the first token on a line, then it shall Invalid Preprocessor MisraC++2008:16-0-8 LANG.PREPROC.INVALID closely mapped be immediately followed by a Directive preprocessing token.

All #else, #elif and #endif preprocessor directives shall LANG.PREPROC.NOENDI MisraC++2008:16-1-2 reside in the same file as the #if No Matching #endif closely mapped F or #ifdef directive to which they are related.

All #else, #elif and #endif preprocessor directives shall MisraC++2008:16-1-2 reside in the same file as the #if LANG.PREPROC.NOIF No Matching #if closely mapped or #ifdef directive to which they are related. The ', ", /* or // characters LANG.PREPROC.INCL.FN Dangerous Include MisraC++2008:16-2-4 shall not occur in a header file closely mapped AME File Name name. The \ character should not LANG.PREPROC.INCL.FN Dangerous Include MisraC++2008:16-2-5 closely mapped occur in a header file name. AME File Name

The #include directive shall be MisraC++2008:16-2-6 followed by either a LANG.PREPROC.INCL.MF Malformed #include closely mapped or "filename" sequence. The # and ## operators should Macro Uses ## MisraC++2008:16-3-2 LANG.PREPROC.PASTE closely mapped not be used. Operator Reserved identifiers, macros and functions in the standard Macro Definition of MisraC++2008:17-0-1 LANG.PREPROC.RDEF closely mapped library shall not be defined, Reserved Name redefined or undefined.

Reserved identifiers, macros and functions in the standard Macro Undefinition MisraC++2008:17-0-1 LANG.PREPROC.RUNDEF closely mapped library shall not be defined, of Reserved Name redefined or undefined. The setjmp macro and the MisraC++2008:17-0-5 longjmp function shall not be BADFUNC.LONGJMP Use of longjmp closely mapped used. The setjmp macro and the MisraC++2008:17-0-5 longjmp function shall not be BADFUNC.SETJMP Use of setjmp closely mapped used.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

LANG.PREPROC.INCL.SE MisraC++2008:18-0-1 The C library shall not be used. Use of closely mapped TJMP_H LANG.PREPROC.INCL.SI MisraC++2008:18-0-1 The C library shall not be used. Use of closely mapped GNAL_H LANG.PREPROC.INCL.TG MisraC++2008:18-0-1 The C library shall not be used. Use of closely mapped MATH_H The library functions atof, atoi MisraC++2008:18-0-2 and atol from library BADFUNC.ATOF Use of atof closely mapped shall not be used.

The library functions atof, atoi MisraC++2008:18-0-2 and atol from library BADFUNC.ATOI Use of atoi closely mapped shall not be used.

The library functions atof, atoi MisraC++2008:18-0-2 and atol from library BADFUNC.ATOL Use of atol closely mapped shall not be used.

The library functions atof, atoi MisraC++2008:18-0-2 and atol from library BADFUNC.ATOLL Use of atoll closely mapped shall not be used.

The library functions abort, exit, MisraC++2008:18-0-3 getenv and system from library BADFUNC.ABORT Use of abort closely mapped shall not be used.

The library functions abort, exit, MisraC++2008:18-0-3 getenv and system from library BADFUNC.EXIT Use of exit closely mapped shall not be used.

The library functions abort, exit, MisraC++2008:18-0-3 getenv and system from library BADFUNC.GETENV Use of getenv closely mapped shall not be used.

The library functions abort, exit, MisraC++2008:18-0-3 getenv and system from library BADFUNC.PATH.SYSTEM Use of system closely mapped shall not be used. The time handling functions of Use of MisraC++2008:18-0-4 library shall not be BADFUNC.TIME_H closely mapped Time/Date Function used. The unbounded functions of MisraC++2008:18-0-5 library shall not be BADFUNC.BO.STRCMP Use of strcmp closely mapped used. The unbounded functions of MisraC++2008:18-0-5 library shall not be BADFUNC.BO.STRCPY Use of strcpy closely mapped used. The unbounded functions of MisraC++2008:18-0-5 library shall not be BADFUNC.BO.STRLEN Use of strlen closely mapped used. The macro offsetof shall not be MisraC++2008:18-2-1 BADMACRO.OFFSETOF Use of offsetof closely mapped used. Dynamic heap memory Dynamic Allocation MisraC++2008:18-4-1 ALLOC.POSTINIT closely mapped allocation shall not be used. After Initialization

The signal handling facilities of MisraC++2008:18-7-1 BADFUNC.SIGNAL Use of signal closely mapped shall not be used.

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc. MISRA C++ 2008 Mapping to CodeSonar®

The input/output library Use of MisraC++2008:27-0-1 BADFUNC.STDIO_H closely mapped shall not be used. Input/Output

The stream input/output library Use of MisraC++2008:27-0-1 BADFUNC.WCHAR_H closely mapped shall not be used. Input/Output

GrammaTech Confidential and Proprietary. CodeSonar is a registered trademark of GrammaTech, Inc.