diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5915064e54..3147f97957 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -222,6 +222,7 @@ "Iterators", "Lambdas", "Language1", + "Language2", "Literals", "Loops", "Macros", diff --git a/c/misra/src/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.ql b/c/misra/src/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.ql new file mode 100644 index 0000000000..d1a8a80046 --- /dev/null +++ b/c/misra/src/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.ql @@ -0,0 +1,22 @@ +/** + * @id c/misra/usage-of-assembly-language-should-be-documented + * @name DIR-4-2: All usage of assembly language should be documented + * @description Assembly language is not portable and should be documented. + * @kind problem + * @precision very-high + * @problem.severity warning + * @tags external/misra/id/dir-4-2 + * maintainability + * readability + * external/misra/obligation/advisory + */ + +import cpp +import codingstandards.c.misra +import codingstandards.cpp.rules.usageofassemblernotdocumented.UsageOfAssemblerNotDocumented + +class UsageOfAssemblyLanguageShouldBeDocumentedQuery extends UsageOfAssemblerNotDocumentedSharedQuery { + UsageOfAssemblyLanguageShouldBeDocumentedQuery() { + this = Language2Package::usageOfAssemblyLanguageShouldBeDocumentedQuery() + } +} diff --git a/c/misra/src/rules/RULE-1-4/EmergentLanguageFeaturesUsed.ql b/c/misra/src/rules/RULE-1-4/EmergentLanguageFeaturesUsed.ql new file mode 100644 index 0000000000..e5c55d4fc5 --- /dev/null +++ b/c/misra/src/rules/RULE-1-4/EmergentLanguageFeaturesUsed.ql @@ -0,0 +1,21 @@ +/** + * @id c/misra/emergent-language-features-used + * @name RULE-1-4: Emergent language features shall not be used + * @description Emergent language features may have unpredictable behavior and should not be used. + * @kind problem + * @precision very-high + * @problem.severity warning + * @tags external/misra/id/rule-1-4 + * maintainability + * readability + * external/misra/obligation/required + */ + +import cpp +import codingstandards.c.misra +import codingstandards.cpp.Emergent + +from C11::EmergentLanguageFeature ef +where not isExcluded(ef, Language2Package::emergentLanguageFeaturesUsedQuery()) +select ef, "Usage of emergent language feature." + diff --git a/c/misra/test/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.testref b/c/misra/test/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.testref new file mode 100644 index 0000000000..ea9ce384ea --- /dev/null +++ b/c/misra/test/rules/DIR-4-2/UsageOfAssemblyLanguageShouldBeDocumented.testref @@ -0,0 +1 @@ +cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.expected b/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.expected new file mode 100644 index 0000000000..2745223358 --- /dev/null +++ b/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.expected @@ -0,0 +1,15 @@ +| test.c:1:1:1:21 | #include | Usage of emergent language feature. | +| test.c:2:1:2:22 | #include | Usage of emergent language feature. | +| test.c:3:1:3:24 | #include | Usage of emergent language feature. | +| test.c:4:1:4:20 | #include | Usage of emergent language feature. | +| test.c:6:1:6:49 | #define MACRO(x) _Generic((x), int : 0, long : 1) | Usage of emergent language feature. | +| test.c:7:1:7:32 | #define __STDC_WANT_LIB_EXT1__ 1 | Usage of emergent language feature. | +| test.c:9:16:9:17 | f0 | Usage of emergent language feature. | +| test.c:12:26:12:40 | atomic_new_type | Usage of emergent language feature. | +| test.c:17:15:17:15 | i | Usage of emergent language feature. | +| test.c:19:3:19:10 | alignas(...) | Usage of emergent language feature. | +| test.c:20:3:20:9 | alignas(...) | Usage of emergent language feature. | +| test.c:21:11:21:23 | alignof(int) | Usage of emergent language feature. | +| test.c:22:12:22:23 | alignof(int) | Usage of emergent language feature. | +| test.c:24:27:24:28 | i3 | Usage of emergent language feature. | +| test.c:25:28:25:29 | i4 | Usage of emergent language feature. | diff --git a/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.qlref b/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.qlref new file mode 100644 index 0000000000..6e3737f029 --- /dev/null +++ b/c/misra/test/rules/RULE-1-4/EmergentLanguageFeaturesUsed.qlref @@ -0,0 +1 @@ +rules/RULE-1-4/EmergentLanguageFeaturesUsed.ql \ No newline at end of file diff --git a/c/misra/test/rules/RULE-1-4/test.c b/c/misra/test/rules/RULE-1-4/test.c new file mode 100644 index 0000000000..153c722c94 --- /dev/null +++ b/c/misra/test/rules/RULE-1-4/test.c @@ -0,0 +1,26 @@ +#include //NON_COMPLIANT +#include //NON_COMPLIANT +#include //NON_COMPLIANT +#include //NON_COMPLIANT + +#define MACRO(x) _Generic((x), int : 0, long : 1) // NON_COMPLIANT +#define __STDC_WANT_LIB_EXT1__ 1 // NON_COMPLIANT + +_Noreturn void f0(); // NON_COMPLIANT + +typedef int new_type; // COMPLIANT +typedef _Atomic new_type atomic_new_type; // NON_COMPLIANT + +void f(int p) { + int i0 = _Generic(p, int : 0, long : 1); // NON_COMPLIANT[FALSE_NEGATIVE] + + _Atomic int i; // NON_COMPLIANT + + _Alignas(4) int i1; // NON_COMPLIANT + alignas(4) int i2; // NON_COMPLIANT + int a = _Alignof(int); // NON_COMPLIANT + int a1 = alignof(int); // NON_COMPLIANT + + static thread_local int i3; // NON_COMPLIANT + static _Thread_local int i4; // NON_COMPLIANT +} \ No newline at end of file diff --git a/cpp/autosar/src/rules/M7-4-1/UsageOfAssemblerNotDocumented.ql b/cpp/autosar/src/rules/M7-4-1/UsageOfAssemblerNotDocumented.ql index 418a96ffee..f39b01b7ed 100644 --- a/cpp/autosar/src/rules/M7-4-1/UsageOfAssemblerNotDocumented.ql +++ b/cpp/autosar/src/rules/M7-4-1/UsageOfAssemblerNotDocumented.ql @@ -17,10 +17,10 @@ import cpp import codingstandards.cpp.autosar +import codingstandards.cpp.rules.usageofassemblernotdocumented.UsageOfAssemblerNotDocumented -from AsmStmt a -where - not isExcluded(a, BannedLibrariesPackage::usageOfAssemblerNotDocumentedQuery()) and - not exists(Comment c | c.getCommentedElement() = a) and - not a.isAffectedByMacro() -select a, "Use of assembler is not documented." +class UsageOfAssemblerNotDocumentedQuery extends UsageOfAssemblerNotDocumentedSharedQuery { + UsageOfAssemblerNotDocumentedQuery() { + this = BannedLibrariesPackage::usageOfAssemblerNotDocumentedQuery() + } +} diff --git a/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.qlref b/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.qlref deleted file mode 100644 index 164f0c5b29..0000000000 --- a/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.qlref +++ /dev/null @@ -1 +0,0 @@ -rules/M7-4-1/UsageOfAssemblerNotDocumented.ql \ No newline at end of file diff --git a/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.testref b/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.testref new file mode 100644 index 0000000000..ea9ce384ea --- /dev/null +++ b/cpp/autosar/test/rules/M7-4-1/UsageOfAssemblerNotDocumented.testref @@ -0,0 +1 @@ +cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.ql \ No newline at end of file diff --git a/cpp/common/src/codingstandards/cpp/Emergent.qll b/cpp/common/src/codingstandards/cpp/Emergent.qll new file mode 100644 index 0000000000..9036c12bd7 --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/Emergent.qll @@ -0,0 +1,49 @@ +import cpp + +/** + * Namespace for containing emergent language features in C11. + */ +module C11 { + abstract class EmergentLanguageFeature extends Element { } + + class AlignAsAttribute extends EmergentLanguageFeature, Attribute { + AlignAsAttribute() { getName() = "_Alignas" } + } + + class AtomicVariableSpecifier extends EmergentLanguageFeature, Variable { + AtomicVariableSpecifier() { + getType().(DerivedType).getBaseType*().getASpecifier().getName() = "atomic" + } + } + + class AtomicDeclaration extends EmergentLanguageFeature, Declaration { + AtomicDeclaration() { getASpecifier().getName() = "atomic" } + } + + class ThreadLocalDeclaration extends EmergentLanguageFeature, Declaration { + ThreadLocalDeclaration() { getASpecifier().getName() = "is_thread_local" } + } + + class EmergentHeader extends EmergentLanguageFeature, Include { + EmergentHeader() { + getIncludedFile().getBaseName() = ["stdalign.h", "stdatomic.h", "stdnoreturn.h", "threads.h"] + } + } + + class LibExt1Macro extends EmergentLanguageFeature, Macro { + LibExt1Macro() { + getName() = "__STDC_WANT_LIB_EXT1__" and + getBody() = "1" + } + } + + class GenericMacro extends EmergentLanguageFeature, Macro { + GenericMacro() { getBody().indexOf("_Generic") = 0 } + } + + class NoReturnSpecificer extends EmergentLanguageFeature, Function { + NoReturnSpecificer() { getASpecifier().getName() = "noreturn" } + } + + class AlignOf extends EmergentLanguageFeature, AlignofTypeOperator { } +} diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/Language2.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/Language2.qll new file mode 100644 index 0000000000..0217551e59 --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/Language2.qll @@ -0,0 +1,42 @@ +//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/ +import cpp +import RuleMetadata +import codingstandards.cpp.exclusions.RuleMetadata + +newtype Language2Query = + TUsageOfAssemblyLanguageShouldBeDocumentedQuery() or + TEmergentLanguageFeaturesUsedQuery() + +predicate isLanguage2QueryMetadata(Query query, string queryId, string ruleId) { + query = + // `Query` instance for the `usageOfAssemblyLanguageShouldBeDocumented` query + Language2Package::usageOfAssemblyLanguageShouldBeDocumentedQuery() and + queryId = + // `@id` for the `usageOfAssemblyLanguageShouldBeDocumented` query + "c/misra/usage-of-assembly-language-should-be-documented" and + ruleId = "DIR-4-2" + or + query = + // `Query` instance for the `emergentLanguageFeaturesUsed` query + Language2Package::emergentLanguageFeaturesUsedQuery() and + queryId = + // `@id` for the `emergentLanguageFeaturesUsed` query + "c/misra/emergent-language-features-used" and + ruleId = "RULE-1-4" +} + +module Language2Package { + Query usageOfAssemblyLanguageShouldBeDocumentedQuery() { + //autogenerate `Query` type + result = + // `Query` type for `usageOfAssemblyLanguageShouldBeDocumented` query + TQueryC(TLanguage2PackageQuery(TUsageOfAssemblyLanguageShouldBeDocumentedQuery())) + } + + Query emergentLanguageFeaturesUsedQuery() { + //autogenerate `Query` type + result = + // `Query` type for `emergentLanguageFeaturesUsed` query + TQueryC(TLanguage2PackageQuery(TEmergentLanguageFeaturesUsedQuery())) + } +} diff --git a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll index 4dc785d482..5e7a315c46 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll @@ -21,6 +21,7 @@ import IO2 import IO3 import IO4 import Language1 +import Language2 import Misc import Pointers1 import Pointers2 @@ -58,6 +59,7 @@ newtype TCQuery = TIO3PackageQuery(IO3Query q) or TIO4PackageQuery(IO4Query q) or TLanguage1PackageQuery(Language1Query q) or + TLanguage2PackageQuery(Language2Query q) or TMiscPackageQuery(MiscQuery q) or TPointers1PackageQuery(Pointers1Query q) or TPointers2PackageQuery(Pointers2Query q) or @@ -95,6 +97,7 @@ predicate isQueryMetadata(Query query, string queryId, string ruleId) { isIO3QueryMetadata(query, queryId, ruleId) or isIO4QueryMetadata(query, queryId, ruleId) or isLanguage1QueryMetadata(query, queryId, ruleId) or + isLanguage2QueryMetadata(query, queryId, ruleId) or isMiscQueryMetadata(query, queryId, ruleId) or isPointers1QueryMetadata(query, queryId, ruleId) or isPointers2QueryMetadata(query, queryId, ruleId) or diff --git a/cpp/common/src/codingstandards/cpp/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.qll b/cpp/common/src/codingstandards/cpp/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.qll new file mode 100644 index 0000000000..8cdb9cbbf0 --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.qll @@ -0,0 +1,19 @@ +/** + * Provides a library which includes a `problems` predicate for reporting + * undocumented uses of assembly. + */ + +import cpp +import codingstandards.cpp.Customizations +import codingstandards.cpp.Exclusions + +abstract class UsageOfAssemblerNotDocumentedSharedQuery extends Query { } + +Query getQuery() { result instanceof UsageOfAssemblerNotDocumentedSharedQuery } + +query predicate problems(AsmStmt a, string message) { + not isExcluded(a, getQuery()) and + not exists(Comment c | c.getCommentedElement() = a) and + not a.isAffectedByMacro() and + message = "Use of assembler is not documented." +} diff --git a/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.expected b/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.expected new file mode 100644 index 0000000000..aa625dd58a --- /dev/null +++ b/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.expected @@ -0,0 +1 @@ +| test.cpp:8:42:8:58 | asm statement | Use of assembler is not documented. | diff --git a/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.ql b/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.ql new file mode 100644 index 0000000000..7f9e1041a2 --- /dev/null +++ b/cpp/common/test/rules/usageofassemblernotdocumented/UsageOfAssemblerNotDocumented.ql @@ -0,0 +1,2 @@ +// GENERATED FILE - DO NOT MODIFY +import codingstandards.cpp.rules.usageofassemblernotdocumented.UsageOfAssemblerNotDocumented diff --git a/cpp/common/test/rules/usageofassemblernotdocumented/test.cpp b/cpp/common/test/rules/usageofassemblernotdocumented/test.cpp new file mode 100644 index 0000000000..16e0f9ca91 --- /dev/null +++ b/cpp/common/test/rules/usageofassemblernotdocumented/test.cpp @@ -0,0 +1,12 @@ +// COMPLIANT +void test_assembly_is_documented() { + // This comment serves as documentation + __asm__("ret\n"); +} + +// NON_COMPLIANT +void test_assembly_is_not_documented() { __asm__("ret\n"); } + +// COMPLIANT +#define RETURN __asm__("ret\n") +void test_undocumented_assembly_from_macro() { RETURN; } \ No newline at end of file diff --git a/rule_packages/c/Language2.json b/rule_packages/c/Language2.json new file mode 100644 index 0000000000..66f219a025 --- /dev/null +++ b/rule_packages/c/Language2.json @@ -0,0 +1,45 @@ +{ + "MISRA-C-2012": { + "DIR-4-2": { + "properties": { + "obligation": "advisory" + }, + "queries": [ + { + "description": "Assembly language is not portable and should be documented.", + "kind": "problem", + "name": "All usage of assembly language should be documented", + "precision": "very-high", + "severity": "warning", + "short_name": "UsageOfAssemblyLanguageShouldBeDocumented", + "shared_implementation_short_name": "UsageOfAssemblerNotDocumented", + "tags": [ + "maintainability", + "readability" + ] + } + ], + "title": "All usage of assembly language should be documented" + }, + "RULE-1-4": { + "properties": { + "obligation": "required" + }, + "queries": [ + { + "description": "Emergent language features may have unpredictable behavior and should not be used.", + "kind": "problem", + "name": "Emergent language features shall not be used", + "precision": "very-high", + "severity": "warning", + "short_name": "EmergentLanguageFeaturesUsed", + "tags": [ + "maintainability", + "readability" + ] + } + ], + "title": "Emergent language features shall not be used" + } + } +} \ No newline at end of file diff --git a/rule_packages/cpp/BannedLibraries.json b/rule_packages/cpp/BannedLibraries.json index 4eb5896cfd..09b5d2f224 100644 --- a/rule_packages/cpp/BannedLibraries.json +++ b/rule_packages/cpp/BannedLibraries.json @@ -229,6 +229,7 @@ "precision": "very-high", "severity": "recommendation", "short_name": "UsageOfAssemblerNotDocumented", + "shared_implementation_short_name": "UsageOfAssemblerNotDocumented", "tags": [ "readability", "maintainability", diff --git a/rules.csv b/rules.csv index 7b283db8b0..bb4456877e 100644 --- a/rules.csv +++ b/rules.csv @@ -14,7 +14,7 @@ cpp,AUTOSAR,A1-1-2,Yes,Required,Non-Automated,Implementation / Toolchain,A warni cpp,AUTOSAR,A1-1-3,Yes,Required,Non-Automated,Toolchain,An optimization option that disregards strict standard compliance shall not be turned on in the chosen compiler.,,Toolchain,Easy,Note: this is currently only possible for compilations that do not use response files. cpp,AUTOSAR,A1-2-1,No,Required,Non-Automated,Toolchain,"When using a compiler toolchain (including preprocessor, compiler itself, linker, C++ standard libraries) in safety-related software, the tool confidence level (TCL) shall be determined. In case of TCL2 or TCL3, the compiler shall undergo a 'Qualification of a software tool', as per ISO 26262-8.11.4.6 [6].",,,,Allocated target not covered by CodeQL cpp,AUTOSAR,A1-4-1,No,Required,Non-Automated,Implementation / Verification,Code metrics and their valid boundaries shall be defined and code shall comply with defined boundaries of code metrics.,,,,Allocated target not covered by CodeQL -cpp,AUTOSAR,A1-4-3,No,Advisory,Automated,Implementation,All code should compile free of compiler warnings.,,,,"This should be checked via the compiler output, rather than CodeQL, which adds unecessary steps." +cpp,AUTOSAR,A1-4-3,No,Advisory,Automated,Implementation,All code should compile free of compiler warnings.,,,,"This should be checked via the compiler output, rather than CodeQL, which adds unnecessary steps." cpp,AUTOSAR,A10-0-1,Yes,Required,Non-Automated,Design,Public inheritance shall be used to implement 'is-a' relationship.,,Inheritance,Audit,Report a list of Inheritance relationships. cpp,AUTOSAR,A10-0-2,Yes,Required,Non-Automated,Design,Membership or non-public inheritance shall be used to implement 'has-a' relationship.,,Inheritance,Audit,Report a list of membership relationships. cpp,AUTOSAR,A10-1-1,Yes,Required,Automated,Implementation,Class shall not be derived from more than one base class which is not an interface class.,,Inheritance,Easy, @@ -600,10 +600,10 @@ c,CERT-C,STR37-C,Yes,Rule,,,Arguments to character-handling functions must be re c,CERT-C,STR38-C,Yes,Rule,,,Do not confuse narrow and wide character strings and functions,,Strings3,Medium, c,CERT-C,WIN30-C,OutOfScope,Rule,,,Properly pair allocation and deallocation functions,DCL54-CPP,,Easy, c,MISRA-C-2012,DIR-1-1,No,Required,,,Any implementation-defined behaviour on which the output of the program depends shall be documented and understood,,,, -c,MISRA-C-2012,DIR-2-1,Yes,Required,,,All source files shall compile without any compilation errors,A1-4-3,Language,Medium, +c,MISRA-C-2012,DIR-2-1,No,Required,,,All source files shall compile without any compilation errors,A1-4-3,,Medium,"This should be checked via the compiler output, rather than CodeQL, which adds unnecessary steps." c,MISRA-C-2012,DIR-3-1,No,Required,,,All code shall be traceable to documented requirements,,,, c,MISRA-C-2012,DIR-4-1,No,Required,,,Run-time failures shall be minimized,,,, -c,MISRA-C-2012,DIR-4-2,Yes,Advisory,,,All usage of assembly language should be documented,M7-4-1,Language,Import, +c,MISRA-C-2012,DIR-4-2,Yes,Advisory,,,All usage of assembly language should be documented,M7-4-1,Language2,Import, c,MISRA-C-2012,DIR-4-3,Yes,Required,,,Assembly language shall be encapsulated and isolated,,Language1,Medium, c,MISRA-C-2012,DIR-4-4,Yes,Advisory,,,Sections of code should not be commented out,A2-7-2,Syntax,Import, c,MISRA-C-2012,DIR-4-5,Yes,Advisory,,,Identifiers in the same name space with overlapping visibility should be typographically unambiguous,M2-10-1,Syntax,Easy, @@ -616,10 +616,10 @@ c,MISRA-C-2012,DIR-4-11,Yes,Required,,,The validity of values passed to library c,MISRA-C-2012,DIR-4-12,Yes,Required,,,Dynamic memory allocation shall not be used,,Banned,Medium, c,MISRA-C-2012,DIR-4-13,Yes,Advisory,,,Functions which are designed to provide operations on a resource should be called in an appropriate sequence,,Contracts,Hard, c,MISRA-C-2012,DIR-4-14,Yes,Required,,,The validity of values received from external sources shall be checked,,Contracts,Hard, -c,MISRA-C-2012,RULE-1-1,Yes,Required,,,"The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation�s translation limits",,Language,Easy, -c,MISRA-C-2012,RULE-1-2,Yes,Advisory,,,Language extensions should not be used,,Language,Easy, -c,MISRA-C-2012,RULE-1-3,Yes,Required,,,There shall be no occurrence of undefined or critical unspecified behaviour,,Language,Hard, -c,MISRA-C-2012,RULE-1-4,Yes,Required,,,Emergent language features shall not be used,,Language,Medium, +c,MISRA-C-2012,RULE-1-1,No,Required,,,"The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits",,,Easy,"This should be checked via the compiler output, rather than CodeQL, which adds unnecessary steps." +c,MISRA-C-2012,RULE-1-2,Yes,Advisory,,,Language extensions should not be used,,Language3,Hard, +c,MISRA-C-2012,RULE-1-3,Yes,Required,,,There shall be no occurrence of undefined or critical unspecified behaviour,,Language3,Hard, +c,MISRA-C-2012,RULE-1-4,Yes,Required,,,Emergent language features shall not be used,,Language2,Medium, c,MISRA-C-2012,RULE-2-1,Yes,Required,,,A project shall not contain unreachable code,M0-1-1,DeadCode,Import, c,MISRA-C-2012,RULE-2-2,Yes,Required,,,There shall be no dead code,M0-1-9,DeadCode,Import, c,MISRA-C-2012,RULE-2-3,Yes,Advisory,,,A project should not contain unused type declarations,A0-1-6,DeadCode,Import,