CodeCheck Documentation
CodeCheck Documentation - MISRA C 2023

Standard: MISRA C 2023

The The Motor Industry Software Reliability Association (MISRA) guidelines for C published in 2023

MISRA Mission Statement:

We provide world-leading, best practice guidelines for the safe and secure application of both embedded control systems and standalone software.

MISRA is a collaboration between manufacturers, component suppliers and engineering consultancies which seeks to promote best practice in developing safety and security-related electronic systems and other software-intensive applications. To this end, MISRA publishes documents that provide accessible information for engineers and management, and holds events to permit the exchange of experiences between practitioners

www.misra.org.uk

Copyright© 2023 The MISRA Consortium Limited

All RulesAdvisory RulesMandatory RulesRequired Rules
Understand % Coverage77%75%62%80%
Understand Coverage13730899
Total Rules1774013124
Check IDCheck NameSupportedCategory
MISRA23_1.11.1 The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limitsYesRequired
MISRA23_1.21.2 Language extensions should not be usedNoAdvisory
MISRA23_1.31.3 There shall be no occurrence of undefined or critical unspecified behaviourNoRequired
MISRA23_2.12.1 A project shall not contain unreachable codeYesRequired
MISRA23_2.22.2 A project shall not contain dead codeNoRequired
MISRA23_2.32.3 A project should not contain unused type declarationsYesAdvisory
MISRA23_2.42.4 A project should not contain unused tag declarationsYesAdvisory
MISRA23_2.52.5 A project should not contain unused macro declarationsYesAdvisory
MISRA23_2.62.6 A function should not contain unused label declarationsYesRequired
MISRA23_2.72.7 A function should not contain unused parametersYesAdvisory
MISRA23_3.13.1 The character sequences /* and // shall not be used within a commentYesRequired
MISRA23_3.23.2 Line-splicing shall not be used in // commentsYesRequired
MISRA23_4.14.1 Octal and Hexadecimal SequencesYesRequired
MISRA23_4.24.2 Trigraphs should not be usedYesAdvisory
MISRA23_5.15.1 External identifiers shall be distinctYesRequired
MISRA23_5.25.2 Identifiers declared in the same scope and name space shall be distinctYesRequired
MISRA23_5.35.3 An identifier declared in an inner scope shall not hide an identifier declared in an outer scopeYesRequired
MISRA23_5.45.4 Macro identifiers shall be distinctYesRequired
MISRA23_5.55.5 Identifiers shall be distinct from macro namesYesRequired
MISRA23_5.65.6 A typedef name shall be a unique identifierYesRequired
MISRA23_5.75.7 A tag name shall be a unique identifierYesRequired
MISRA23_5.85.8 Identifiers that define objects or functions with external linkage shall be uniqueYesRequired
MISRA23_5.95.9 Identifiers that define objects or functions with internal linkage should be uniqueYesAdvisory
MISRA23_6.16.1 Bit-fields shall only be declared with an appropriate typeYesRequired
MISRA23_6.26.2 Single-bit named bit fields shall not be of a signed typeYesRequired
MISRA23_6.36.3 A bit field shall not be declared as a member of a unionYesRequired
MISRA23_7.17.1 Octal constants shall not be usedYesRequired
MISRA23_7.27.2 A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned typeYesRequired
MISRA23_7.37.3 The lowercase character "l" shall not be used in a literal suffixYesRequired
MISRA23_7.47.4 A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char"NoRequired
MISRA23_8.18.1 Types shall be explicitly specifiedYesRequired
MISRA23_8.28.2 Use Named Parameters and Prototype FormYesRequired
MISRA23_8.38.3 All declarations of an object or function shall use the same names and type qualifiersYesRequired
MISRA23_8.48.4 A compatible declaration shall be visible when an object or function with external linkage is definedYesRequired
MISRA23_8.58.5 An external object or function shall be declared once in one and only one fileYesRequired
MISRA23_8.68.6 An identifier with external linkage shall have exactly one external definitionYesRequired
MISRA23_8.78.7 Functions and objects should not be defined with external linkage if they are referenced in only one translation unitYesAdvisory
MISRA23_8.88.8 The static storage class specifier shall be used in all declarations of objects and functions that have internal linkageYesRequired
MISRA23_8.98.9 An object should be declared at block scope if its identifier only appears in a single functionYesAdvisory
MISRA23_8.108.10 Non-static Inline FunctionsYesRequired
MISRA23_8.118.11 When an array with external linkage is declared, its size should be explicitly specifiedYesAdvisory
MISRA23_8.128.12 Within an enumerator list, the value of an implicitly-specified enumeration constant shall be uniqueYesRequired
MISRA23_8.138.13 A pointer should point to a const-qualified type whenever possibleNoAdvisory
MISRA23_8.148.14 The restrict type qualifier shall not be usedYesRequired
MISRA23_8.168.16 The alignment specification of zero should not appear in an object declarationYesAdvisory
MISRA23_8.178.17 At most one explicit alignment specifier should appear in an object declarationYesAdvisory
MISRA23_9.19.1 The value of an object with automatic storage duration shall not be read before it has been setYesMandatory
MISRA23_9.29.2 The initializer for an aggregate or union shall be enclosed in bracesYesRequired
MISRA23_9.39.3 Arrays shall not be partially initializedYesRequired
MISRA23_9.49.4 An element of an object shall not be initialized more than onceYesRequired
MISRA23_9.59.5 Where designated initializers are used to initialize an array object the size of the array shall be specified explicitlyYesRequired
MISRA23_9.79.7 Atomic objects shall be appropriately initialized before being accessedYesMandatory
MISRA23_10.110.1 Operands shall not be of an inappropriate essential typeYesRequired
MISRA23_10.210.2 Expressions of essentially character type shall not be used inappropriately in addition and subtraction operationsNoRequired
MISRA23_10.310.3 The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type categoryNoRequired
MISRA23_10.410.4 Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type categoryYesRequired
MISRA23_10.510.5 The value of an expression should not be cast to an inappropriate essential typeYesAdvisory
MISRA23_10.610.6 The value of a composite expression shall not be assigned to an object with
wider essential type
YesRequired
MISRA23_10.710.7 If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential typeNoRequired
MISRA23_10.810.8 The value of a composite expression shall not be cast to a different essential type category or a wider essential typeYesRequired
MISRA23_11.111.1 Conversions shall not be performed between a pointer to a function and any other typeYesRequired
MISRA23_11.211.2 Conversions shall not be performed between a pointer to an incomplete type
and any other type
YesRequired
MISRA23_11.311.3 A cast shall not be performed between a pointer to object type and a pointer to a different object typeYesRequired
MISRA23_11.411.4 A conversion should not be performed between a pointer to object and an integer typeYesRequired
MISRA23_11.511.5 A conversion should not be performed from pointer to void into pointer to objectYesAdvisory
MISRA23_11.611.6 A cast shall not be performed between pointer to void and an arithmetic typeYesRequired
MISRA23_11.711.7 A cast shall not be performed between pointer to object and a non-integer arithmetic typeYesRequired
MISRA23_11.811.8 A conversion shall not remove any const, volatile or _Atomic qualification from the type pointed to by a pointerYesRequired
MISRA23_11.911.9 The macro NULL shall be the only permitted form of integer null pointer constantYesRequired
MISRA23_12.112.1 The precedence of operators within expressions should be made explicitNoAdvisory
MISRA23_12.212.2 The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operandYesRequired
MISRA23_12.312.3 The comma operator shall not be used.YesAdvisory
MISRA23_12.412.4 Evaluation of constant expressions should not lead to unsigned integer wrap-aroundNoAdvisory
MISRA23_13.113.1 Initializer lists shall not contain persistent side effectsYesRequired
MISRA23_13.213.2 The value of an expression and its persistent side effects shall be the same under all permitted evaluation ordersNoRequired
MISRA23_13.313.3 A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operatorYesAdvisory
MISRA23_13.413.4 The result of an assignment operator should not be usedYesAdvisory
MISRA23_13.513.5 The right hand operand of a logical && or || operator shall not contain persistent side effectsYesRequired
MISRA23_13.613.6 The operand of the sizeof operator shall not contain any expression which has potential side effectsYesMandatory
MISRA23_14.114.1 A loop counter shall not have essentially floating typeYesRequired
MISRA23_14.214.2 A for loop shall be well-formedNoRequired
MISRA23_14.314.3 Controlling expressions shall not be invariantNoRequired
MISRA23_14.414.4 The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean typeYesRequired
MISRA23_15.115.1 The goto statement should not be usedYesAdvisory
MISRA23_15.215.2 The goto statement shall jump to a label declared later in the same functionYesRequired
MISRA23_15.315.3 Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statementYesRequired
MISRA23_15.415.4 There should be no more than one break or goto statement used to terminate any iteration statementYesAdvisory
MISRA23_15.515.5 A function should have a single point of exit at the endYesAdvisory
MISRA23_15.615.6 The body of an iteration-statement or a selection-statement shall be a compound-statement YesRequired
MISRA23_15.715.7 All if ... else if constructs shall be terminated with an else statementYesRequired
MISRA23_16.1Switch Statement not Well-formedYesRequired
MISRA23_16.216.2 A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statementYesRequired
MISRA23_16.316.3 An unconditional break statement shall terminate every switch-clauseYesRequired
MISRA23_16.416.4 Every switch statement shall have a default labelYesRequired
MISRA23_16.516.5 A default label shall appear as either the first or the last switch label of a switch statementYesRequired
MISRA23_16.616.6 Every switch statement shall have at least two switch-clausesYesRequired
MISRA23_16.716.7 A switch-expression shall not have essentially Boolean typeNoRequired
MISRA23_17.117.1 The standard header file <stdarg.h> shall not be usedYesRequired
MISRA23_17.217.2 Functions shall not call themselves, either directly or indirectlyYesRequired
MISRA23_17.317.3 A function shall not be declared implicitlyYesMandatory
MISRA23_17.417.4 All exit paths from a function with non-void return type shall have an explicit return statement with an expressionYesRequired
MISRA23_17.517.5 The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elementsNoAdvisory
MISRA23_17.617.6 The declaration of an array parameter shall not contain the static keyword between the [ ]YesMandatory
MISRA23_17.7The value returned by a function having non-void return type shall be usedYesRequired
MISRA23_17.817.8 A function parameter should not be modifiedYesAdvisory
MISRA23_17.1017.10 A function declared with a _Noreturn function specifier shall have void return typeYesRequired
MISRA23_17.1217.12 A function identifier should only be used with either a preceding &, or with a parenthesized parameter listYesRequired
MISRA23_17.1317.13 A function type shall not be type qualifiedYesRequired
MISRA23_18.118.1 A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operandNoRequired
MISRA23_18.218.2 Subtraction between pointers shall only be applied to pointers that address elements of the same arrayYesRequired
MISRA23_18.318.3 The relational operators >, >=, < and <= shall not be applied to objects of pointer type except where they point into the same objectYesRequired
MISRA23_18.418.4 The +, -, += and -= operators should not be applied to an expression of pointer typeNoAdvisory
MISRA23_18.518.5 Declarations should contain no more than two levels of pointer nestingNoAdvisory
MISRA23_18.618.6 The address of an object with automatic or thread-local storage shall not be copied to another object that persists after the first object has ceased to existYesRequired
MISRA23_18.718.7 Flexible array members shall not be declaredYesRequired
MISRA23_18.818.8 Variable-length array types shall not be usedNoRequired
MISRA23_19.0.319.0.3 #include directives should only be preceded by preprocessor directives or commentsYesAdvisory
MISRA23_19.119.1 An object shall not be assigned or copied to an overlapping objectNoMandatory
MISRA23_19.219.2 The union keyword should not be usedYesAdvisory
MISRA23_20.120.1 #include directives should only be preceded by preprocessor directives or commentsYesAdvisory
MISRA23_20.220.2 The ', " or backslash characters and the /* or // character sequences shall not occur in a header file nameYesRequired
MISRA23_20.320.3 The #include directive shall be followed by either a <filename> or "filename" sequenceYesRequired
MISRA23_20.420.4 A macro shall not be defined with the same name as a keywordYesRequired
MISRA23_20.520.5 #undef should not be usedYesAdvisory
MISRA23_20.620.6 Tokens that look like a preprocessing directive shall not occur within a macro argumentYesRequired
MISRA23_20.720.7 Expressions resulting from the expansion of macro parameters shall be enclosed in parenthesesNoRequired
MISRA23_20.820.8 The controlling expression of a #if or #elif preprocessing directive shall evaluate to 0 or 1NoRequired
MISRA23_20.920.9 All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define'd before evaluationNoRequired
MISRA23_20.1020.10 The # and ## operators should not be usedYesAdvisory
MISRA23_20.1120.11 A macro parameter immediately following a # operator shall not immediately be followed by a ## operatorYesRequired
MISRA23_20.1220.12 A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operatorsNoRequired
MISRA23_20.1320.13 A line whose first token is # shall be a valid preprocessing directiveYesRequired
MISRA23_20.1420.14 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are relatedYesRequired
MISRA23_21.121.1 #define and #undef shall not be used on a reserved identifier or reserved macro nameYesRequired
MISRA23_21.221.2 Reserved Identifiers or MacrosYesRequired
MISRA23_21.321.3 The memory allocation and deallocation functions of &lt;stdlib.h&gt; shall not be usedYesRequired
MISRA23_21.421.4 The standard header file <setjmp.h> shall not be usedYesRequired
MISRA23_21.521.5 The standard header file <signal.h> shall not be usedYesRequired
MISRA23_21.621.6 The Standard Library input/output functions shall not be usedYesRequired
MISRA23_21.721.7 The Standard Library functions atof, atoi, atol and atoll of <stdlib.h> shall not be usedYesRequired
MISRA23_21.821.8 The Standard Library termination functions of <stdlib.h> shall not be usedYesRequired
MISRA23_21.921.9 The library functions bsearch and qsort of <stdlib.h> shall not be usedYesRequired
MISRA23_21.1021.10 The Standard Library time and date functions shall not be usedYesRequired
MISRA23_21.1121.11 The standard header file <tgmath.h> shall not be usedYesAdvisory
MISRA23_21.1221.12 The standard header file <fenv.h> shall not be usedYesRequired
MISRA23_21.1721.17 Use of the string handling functions from <string.h> shall not result in accesses beyond the bounds of the objects referenced by their pointer parametersYesMandatory
MISRA23_21.1921.19 The pointers returned by the Standard Library functions localeconv, getenv, setlocale or, strerror shall only be used as if they have pointer to const-qualified typeYesMandatory
MISRA23_21.2021.20 The pointer returned by the C++ Standard Library functions asctime, ctime, gmtime, localtime, localeconv, getenv, setlocale or strerror must not be used following a subsequent call to the same functionYesMandatory
MISRA23_21.2121.21 The Standard Library function system of <stdlib.h> shall not be usedYesRequired
MISRA23_21.2421.24 The random number generator functions of <stdlib.h> shall not be usedYesRequired
MISRA23_22.122.1 All resources obtained dynamically by means of Standard Library functions shall be explicitly releasedNoRequired
MISRA23_22.222.2 A block of memory shall only be freed if it was allocated by means of a Standard Library functionNoMandatory
MISRA23_22.322.3 The same file shall not be open for read and write access at the same time on different streamsNoRequired
MISRA23_22.422.4 There shall be no attempt to write to a stream which has been opened as read-onlyNoMandatory
MISRA23_22.522.5 A pointer to a FILE object shall not be dereferencedNoMandatory
MISRA23_22.622.6 The value of a pointer to a FILE shall not be used after the associated stream has been closedNoMandatory
MISRA23_22.1122.11 A thread that was previously either joined or detached shall not be subsequently joined nor detachedYesRequired
MISRA23_22.1322.13 Thread objects, thread synchronization objects and thread-specific storage pointers shall have appropriate storage durationYesRequired
MISRA23_22.1722.17 No thread shall unlock a mutex or call cnd_wait() or cnd_timedwait() for a mutex it has not locked beforeYesRequired
MISRA23_DIR_1.1Directive 1.1 Any implementation-defined behaviour on which the output of the program depends shall be documented and understoodNoRequired
MISRA23_DIR_2.1Directive 2.1 All source files shall compile without any compilation errorsYesRequired
MISRA23_DIR_3.1Directive 3.1 All code shall be traceable to documented requirementsNoRequired
MISRA23_DIR_4.1Directive 4.1 Run-time failures shall be minimizedNoRequired
MISRA23_DIR_4.2Directive 4.2 All usage of assembly language should be documentedNoAdvisory
MISRA23_DIR_4.3Directive 4.3 Assembly language shall be encapsulated and isolated.YesRequired
MISRA23_DIR_4.4Directive 4.4 Sections of code should not be "commented out"YesAdvisory
MISRA23_DIR_4.5Directive 4.5 Identifiers in the same name space with overlapping visibility should be typographically unambiguousYesAdvisory
MISRA23_DIR_4.6Directive 4.6 Typedefs that indicate size and signedness should be used in place of the basic numerical typesYesAdvisory
MISRA23_DIR_4.7Directive 4.7 If a function returns error information, then that error information shall be testedNoRequired
MISRA23_DIR_4.8Directive 4.8 If a pointer to a structure or union is never dereferenced within a translation unit, then the implementation of the object should be hiddenYesAdvisory
MISRA23_DIR_4.9Directive 4.9 A function should be used in preference to a function-like macro where they are interchangeableNoAdvisory
MISRA23_DIR_4.10Directive 4.10 Precautions shall be taken in order to prevent the contents of a header file being included more than onceYesRequired
MISRA23_DIR_4.11Directive 4.11 The validity of values passed to library functions shall be checkedNoRequired
MISRA23_DIR_4.12Directive 4.12 Dynamic memory allocation shall not be usedYesRequired
MISRA23_DIR_4.13Directive 4.13 Functions which are designed to provide operations on a resource should be called in an appropriate sequenceNoAdvisory
MISRA23_DIR_5.1Directive 5.1 There shall be no data races between threadsNoRequired
MISRA23_DIR_5.2Directive 5.2 There shall be no deadlocks between threadsNoRequired