Misra C 2012 Standard format
共143条,与 Cppcheck 的说明一致:
Appendix A Summary of guidelines
Rule 1.1 Required
Rule Required 1.1 The program shall contain no violations of the standard C syntax and constraints and shall not exceed the implementation's translation limits.
Rule 1.2 Advisory
Rule Advisory 1.2 Language extensions should not be used.
Rule 1.3 Required
Rule Required 1.3 There shall be no occurrence of undefined or critical unspecified behaviour.
Rule 2.1 Required
Rule Required 2.1 A project shall not contain unreachable code.
Rule 2.2 Required
Rule Required 2.2 There shall be no dead code.
Rule 2.3 Advisory
Rule Advisory 2.3 A project should not contain unused type declarations.
Rule 2.4 Advisory
Rule Advisory 2.4 A project should not contain unused tag declarations.
Rule 2.5 Advisory
Rule Advisory 2.5 A project should not contain unused macro declarations.
Rule 2.6 Advisory
Rule Advisory 2.6 A function should not contain unused label declarations.
Rule 2.7 Advisory
Rule Advisory 2.7 There should be no unused parameters in functions.
Rule 3.1 Required
Rule Required 3.1 The character sequences /* and // shall not be used within a comment.
Rule 3.2 Required
Rule Required 3.2 Line-splicing shall not be used in // comments.
Rule 4.1 Required
Rule Required 4.1 Octal and hexadecimal escape sequences shall be terminated.
Rule 4.2 Advisory
Rule Advisory 4.2 Trigraphs should not be used.
Rule 5.1 Required
Rule Required 5.1 External identifiers shall be distinct.
Rule 5.2 Required
Rule Required 5.2 Identifiers declared in the same scope and name space shall be distinct.
Rule 5.3 Required
Rule Required 5.3 An identifier declared in an inner scope shall not hide an identifier declared in an outer scope.
Rule 5.4 Required
Rule Required 5.4 Macro identifiers shall be distinct.
Rule 5.5 Required
Rule Required 5.5 Identifiers shall be distinct from macro names.
Rule 5.6 Required
Rule Required 5.6 A typedef name shall be a unique identifier.
Rule 5.7 Required
Rule Required 5.7 A tag name shall be a unique identifier.
Rule 5.8 Required
Rule Required 5.8 Identifiers that define objects or functions with external linkage shall be unique.
Rule 5.9 Advisory
Rule Advisory 5.9 dentifiers that define objects or functions with internal linkage should be unique.
Rule 6.1 Required
Rule Required 6.1 Bit-fields shall only be declared with an appropriate type.
Rule 6.2 Required
Rule Required 6.2 Single-bit named bit fields shall not be of a signed type.
Rule 7.1 Required
Rule Required 7.1 Octal constants shall not be used.
Rule 7.2 Required
Rule Required 7.2 A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned type.
Rule 7.3 Required
Rule Required 7.3 The lowercase character 'l' shall not be used in a literal suffix.
Rule 7.4 Required
Rule Required 7.4 A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char".
Rule 8.1 Required
Rule Required 8.1 Types shall be explicitly specified.
Rule 8.2 Required
Rule Required 8.2 Function types shall be in prototype form with named parameters.
Rule 8.3 Required
Rule Required 8.3 All declarations of an object or function shall use the same names and type qualifiers.
Rule 8.4 Required
Rule Required 8.4 A compatible declaration
文章评论