From d7215f5696de60b0ada9f9635b36b4eff91d88d5 Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Mon, 9 Mar 2026 09:37:21 -0700 Subject: [PATCH 1/4] Draft PR for Rule 4-1-3, no undefined/unspecified behavior --- rule_packages/cpp/Undefined.json | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 rule_packages/cpp/Undefined.json diff --git a/rule_packages/cpp/Undefined.json b/rule_packages/cpp/Undefined.json new file mode 100644 index 000000000..2a3f96342 --- /dev/null +++ b/rule_packages/cpp/Undefined.json @@ -0,0 +1,63 @@ +{ + "MISRA-C++-2023": { + "RULE-4-1-3": { + "properties": { + "enforcement": "undecidable", + "obligation": "required" + }, + "queries": [ + { + "description": "It is not possible to reason about the behaviour of any program that contains instances of undefined behaviour, which can cause unpredictable results that are particularly difficult to detect during testing.", + "kind": "problem", + "name": "There shall be no occurrence of undefined behaviour", + "precision": "high", + "severity": "error", + "short_name": "UndefinedBehavior", + "tags": [ + "correctness", + "scope/system" + ] + }, + { + "description": "Critical unspecified behaviour impacts the observable behaviour of the abstract machine and means a program is not guaranteed to behave predictably.", + "kind": "problem", + "name": "There shall be no occurrence of critical unspecified behaviour", + "precision": "high", + "severity": "error", + "short_name": "CriticalUnspecifiedBehavior", + "tags": [ + "correctness", + "scope/system" + ] + }, + { + "description": "It is not possible to reason about the behaviour of any program that contains instances of undefined behaviour, which can cause unpredictable results that are particularly difficult to detect during testing.", + "kind": "problem", + "name": "Audit: there shall be no occurrence of undefined behaviour", + "precision": "low", + "severity": "error", + "short_name": "UndefinedBehaviorAudit", + "tags": [ + "correctness", + "scope/system", + "external/misra/audit" + ] + }, + { + "description": "Critical unspecified behaviour impacts the observable behaviour of the abstract machine and means a program is not guaranteed to behave predictably.", + "kind": "problem", + "name": "Audit: there shall be no occurrence of critical unspecified behaviour", + "precision": "low", + "severity": "error", + "short_name": "CriticalUnspecifiedBehaviorAudit", + "tags": [ + "correctness", + "scope/system", + "external/misra/audit" + ] + } + ], + "title": "There shall be no occurrence of undefined or critical unspecified behaviour" + } + } +} \ No newline at end of file From 6457dc62f0acd1fd72c4696aa8e2a6cca9ec9f77 Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Mon, 9 Mar 2026 11:33:50 -0700 Subject: [PATCH 2/4] add base ql files --- .../RULE-4-1-3/CriticalUnspecifiedBehavior.ql | 22 +++++++++++++++++ .../CriticalUnspecifiedBehaviorAudit.ql | 23 ++++++++++++++++++ .../src/rules/RULE-4-1-3/UndefinedBehavior.ql | 23 ++++++++++++++++++ .../RULE-4-1-3/UndefinedBehaviorAudit.ql | 24 +++++++++++++++++++ .../CriticalUnspecifiedBehavior.expected | 1 + .../CriticalUnspecifiedBehavior.qlref | 1 + .../CriticalUnspecifiedBehaviorAudit.expected | 1 + .../CriticalUnspecifiedBehaviorAudit.qlref | 1 + .../RULE-4-1-3/UndefinedBehavior.expected | 1 + .../rules/RULE-4-1-3/UndefinedBehavior.qlref | 1 + .../UndefinedBehaviorAudit.expected | 1 + .../RULE-4-1-3/UndefinedBehaviorAudit.qlref | 1 + 12 files changed, 100 insertions(+) create mode 100644 cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql create mode 100644 cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql create mode 100644 cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql create mode 100644 cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql create mode 100644 cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.expected create mode 100644 cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.qlref create mode 100644 cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.expected create mode 100644 cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.qlref create mode 100644 cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.expected create mode 100644 cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.qlref create mode 100644 cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.expected create mode 100644 cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.qlref diff --git a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql new file mode 100644 index 000000000..9cc1ea8b9 --- /dev/null +++ b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql @@ -0,0 +1,22 @@ +/** + * @id cpp/misra/critical-unspecified-behavior + * @name RULE-4-1-3: There shall be no occurrence of critical unspecified behaviour + * @description Critical unspecified behaviour impacts the observable behaviour of the abstract + * machine and means a program is not guaranteed to behave predictably. + * @kind problem + * @precision high + * @problem.severity error + * @tags external/misra/id/rule-4-1-3 + * correctness + * scope/system + * external/misra/enforcement/undecidable + * external/misra/obligation/required + */ + +import cpp +import codingstandards.cpp.misra + +from +where + not isExcluded(x, UndefinedPackage::criticalUnspecifiedBehaviorQuery()) and +select diff --git a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql new file mode 100644 index 000000000..d3c9fe226 --- /dev/null +++ b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql @@ -0,0 +1,23 @@ +/** + * @id cpp/misra/critical-unspecified-behavior-audit + * @name RULE-4-1-3: Audit: there shall be no occurrence of critical unspecified behaviour + * @description Critical unspecified behaviour impacts the observable behaviour of the abstract + * machine and means a program is not guaranteed to behave predictably. + * @kind problem + * @precision low + * @problem.severity error + * @tags external/misra/id/rule-4-1-3 + * correctness + * scope/system + * external/misra/audit + * external/misra/enforcement/undecidable + * external/misra/obligation/required + */ + +import cpp +import codingstandards.cpp.misra + +from +where + not isExcluded(x, UndefinedPackage::criticalUnspecifiedBehaviorAuditQuery()) and +select diff --git a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql new file mode 100644 index 000000000..d8662185f --- /dev/null +++ b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql @@ -0,0 +1,23 @@ +/** + * @id cpp/misra/undefined-behavior + * @name RULE-4-1-3: There shall be no occurrence of undefined behaviour + * @description It is not possible to reason about the behaviour of any program that contains + * instances of undefined behaviour, which can cause unpredictable results that are + * particularly difficult to detect during testing. + * @kind problem + * @precision high + * @problem.severity error + * @tags external/misra/id/rule-4-1-3 + * correctness + * scope/system + * external/misra/enforcement/undecidable + * external/misra/obligation/required + */ + +import cpp +import codingstandards.cpp.misra + +from +where + not isExcluded(x, UndefinedPackage::undefinedBehaviorQuery()) and +select diff --git a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql new file mode 100644 index 000000000..eb8292a43 --- /dev/null +++ b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql @@ -0,0 +1,24 @@ +/** + * @id cpp/misra/undefined-behavior-audit + * @name RULE-4-1-3: Audit: there shall be no occurrence of undefined behaviour + * @description It is not possible to reason about the behaviour of any program that contains + * instances of undefined behaviour, which can cause unpredictable results that are + * particularly difficult to detect during testing. + * @kind problem + * @precision low + * @problem.severity error + * @tags external/misra/id/rule-4-1-3 + * correctness + * scope/system + * external/misra/audit + * external/misra/enforcement/undecidable + * external/misra/obligation/required + */ + +import cpp +import codingstandards.cpp.misra + +from +where + not isExcluded(x, UndefinedPackage::undefinedBehaviorAuditQuery()) and +select diff --git a/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.expected b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.expected new file mode 100644 index 000000000..2ec1a0ac6 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.qlref b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.qlref new file mode 100644 index 000000000..6e1efb194 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.qlref @@ -0,0 +1 @@ +rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.expected b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.expected new file mode 100644 index 000000000..2ec1a0ac6 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.qlref b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.qlref new file mode 100644 index 000000000..5981586f1 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.qlref @@ -0,0 +1 @@ +rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.expected b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.expected new file mode 100644 index 000000000..2ec1a0ac6 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.qlref b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.qlref new file mode 100644 index 000000000..f76d6aebd --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehavior.qlref @@ -0,0 +1 @@ +rules/RULE-4-1-3/UndefinedBehavior.ql \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.expected b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.expected new file mode 100644 index 000000000..2ec1a0ac6 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.expected @@ -0,0 +1 @@ +No expected results have yet been specified \ No newline at end of file diff --git a/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.qlref b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.qlref new file mode 100644 index 000000000..91186b118 --- /dev/null +++ b/cpp/misra/test/rules/RULE-4-1-3/UndefinedBehaviorAudit.qlref @@ -0,0 +1 @@ +rules/RULE-4-1-3/UndefinedBehaviorAudit.ql \ No newline at end of file From b2a648002566ce9e8e77f8cea5510ac4525da999 Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Mon, 9 Mar 2026 19:46:45 -0700 Subject: [PATCH 3/4] Temporarily run workflows on branch PR --- .github/workflows/code-scanning-pack-gen.yml | 1 + .github/workflows/codeql_unit_tests.yml | 1 + .github/workflows/extra-rule-validation.yml | 1 + .github/workflows/tooling-unit-tests.yml | 1 + .github/workflows/validate-package-files.yml | 1 + .github/workflows/validate-query-formatting.yml | 1 + .github/workflows/validate-query-help.yml | 1 + .github/workflows/validate-query-test-case-formatting.yml | 1 + 8 files changed, 8 insertions(+) diff --git a/.github/workflows/code-scanning-pack-gen.yml b/.github/workflows/code-scanning-pack-gen.yml index d5890e454..35cc25d3d 100644 --- a/.github/workflows/code-scanning-pack-gen.yml +++ b/.github/workflows/code-scanning-pack-gen.yml @@ -10,6 +10,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior push: branches: - main diff --git a/.github/workflows/codeql_unit_tests.yml b/.github/workflows/codeql_unit_tests.yml index ccd7bad4b..ece7f378b 100644 --- a/.github/workflows/codeql_unit_tests.yml +++ b/.github/workflows/codeql_unit_tests.yml @@ -15,6 +15,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior jobs: diff --git a/.github/workflows/extra-rule-validation.yml b/.github/workflows/extra-rule-validation.yml index 90b614ecc..bb6faf2f4 100644 --- a/.github/workflows/extra-rule-validation.yml +++ b/.github/workflows/extra-rule-validation.yml @@ -15,6 +15,7 @@ on: - main - "rc/**" - next + - michaelrfairhurst/package-undefined-behavior jobs: diff --git a/.github/workflows/tooling-unit-tests.yml b/.github/workflows/tooling-unit-tests.yml index daa36b7fa..c49ba8eb1 100644 --- a/.github/workflows/tooling-unit-tests.yml +++ b/.github/workflows/tooling-unit-tests.yml @@ -15,6 +15,7 @@ on: - main - "rc/**" - next + - michaelrfairhurst/package-undefined-behavior jobs: prepare-supported-codeql-env-matrix: diff --git a/.github/workflows/validate-package-files.yml b/.github/workflows/validate-package-files.yml index d91112f83..be8f0b139 100644 --- a/.github/workflows/validate-package-files.yml +++ b/.github/workflows/validate-package-files.yml @@ -9,6 +9,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior jobs: validate-package-files: diff --git a/.github/workflows/validate-query-formatting.yml b/.github/workflows/validate-query-formatting.yml index a9eee4844..6f2bb9670 100644 --- a/.github/workflows/validate-query-formatting.yml +++ b/.github/workflows/validate-query-formatting.yml @@ -9,6 +9,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior env: XARGS_MAX_PROCS: 4 diff --git a/.github/workflows/validate-query-help.yml b/.github/workflows/validate-query-help.yml index e16d6efa1..9c80e4fcd 100644 --- a/.github/workflows/validate-query-help.yml +++ b/.github/workflows/validate-query-help.yml @@ -9,6 +9,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior jobs: validate-query-help-files: diff --git a/.github/workflows/validate-query-test-case-formatting.yml b/.github/workflows/validate-query-test-case-formatting.yml index e466a1aed..cc51473a8 100644 --- a/.github/workflows/validate-query-test-case-formatting.yml +++ b/.github/workflows/validate-query-test-case-formatting.yml @@ -9,6 +9,7 @@ on: - main - next - "rc/**" + - michaelrfairhurst/package-undefined-behavior env: XARGS_MAX_PROCS: 4 From 46d7355c111ade4ef7cb861d671e0f09649b5cd2 Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Mon, 9 Mar 2026 19:58:10 -0700 Subject: [PATCH 4/4] Commit compilable stub queries --- .../cpp/exclusions/cpp/RuleMetadata.qll | 3 + .../cpp/exclusions/cpp/Undefined.qll | 78 +++++++++++++++++++ .../RULE-4-1-3/CriticalUnspecifiedBehavior.ql | 7 +- .../CriticalUnspecifiedBehaviorAudit.ql | 7 +- .../src/rules/RULE-4-1-3/UndefinedBehavior.ql | 7 +- .../RULE-4-1-3/UndefinedBehaviorAudit.ql | 7 +- 6 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 cpp/common/src/codingstandards/cpp/exclusions/cpp/Undefined.qll diff --git a/cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll b/cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll index 88537493d..efbe78d41 100644 --- a/cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll +++ b/cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll @@ -85,6 +85,7 @@ import Toolchain3 import Trigraph import TrustBoundaries import TypeRanges +import Undefined import Uninitialized import VirtualFunctions @@ -173,6 +174,7 @@ newtype TCPPQuery = TTrigraphPackageQuery(TrigraphQuery q) or TTrustBoundariesPackageQuery(TrustBoundariesQuery q) or TTypeRangesPackageQuery(TypeRangesQuery q) or + TUndefinedPackageQuery(UndefinedQuery q) or TUninitializedPackageQuery(UninitializedQuery q) or TVirtualFunctionsPackageQuery(VirtualFunctionsQuery q) @@ -261,6 +263,7 @@ predicate isQueryMetadata(Query query, string queryId, string ruleId, string cat isTrigraphQueryMetadata(query, queryId, ruleId, category) or isTrustBoundariesQueryMetadata(query, queryId, ruleId, category) or isTypeRangesQueryMetadata(query, queryId, ruleId, category) or + isUndefinedQueryMetadata(query, queryId, ruleId, category) or isUninitializedQueryMetadata(query, queryId, ruleId, category) or isVirtualFunctionsQueryMetadata(query, queryId, ruleId, category) } diff --git a/cpp/common/src/codingstandards/cpp/exclusions/cpp/Undefined.qll b/cpp/common/src/codingstandards/cpp/exclusions/cpp/Undefined.qll new file mode 100644 index 000000000..1d8dc022a --- /dev/null +++ b/cpp/common/src/codingstandards/cpp/exclusions/cpp/Undefined.qll @@ -0,0 +1,78 @@ +//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/ +import cpp +import RuleMetadata +import codingstandards.cpp.exclusions.RuleMetadata + +newtype UndefinedQuery = + TUndefinedBehaviorQuery() or + TCriticalUnspecifiedBehaviorQuery() or + TUndefinedBehaviorAuditQuery() or + TCriticalUnspecifiedBehaviorAuditQuery() + +predicate isUndefinedQueryMetadata(Query query, string queryId, string ruleId, string category) { + query = + // `Query` instance for the `undefinedBehavior` query + UndefinedPackage::undefinedBehaviorQuery() and + queryId = + // `@id` for the `undefinedBehavior` query + "cpp/misra/undefined-behavior" and + ruleId = "RULE-4-1-3" and + category = "required" + or + query = + // `Query` instance for the `criticalUnspecifiedBehavior` query + UndefinedPackage::criticalUnspecifiedBehaviorQuery() and + queryId = + // `@id` for the `criticalUnspecifiedBehavior` query + "cpp/misra/critical-unspecified-behavior" and + ruleId = "RULE-4-1-3" and + category = "required" + or + query = + // `Query` instance for the `undefinedBehaviorAudit` query + UndefinedPackage::undefinedBehaviorAuditQuery() and + queryId = + // `@id` for the `undefinedBehaviorAudit` query + "cpp/misra/undefined-behavior-audit" and + ruleId = "RULE-4-1-3" and + category = "required" + or + query = + // `Query` instance for the `criticalUnspecifiedBehaviorAudit` query + UndefinedPackage::criticalUnspecifiedBehaviorAuditQuery() and + queryId = + // `@id` for the `criticalUnspecifiedBehaviorAudit` query + "cpp/misra/critical-unspecified-behavior-audit" and + ruleId = "RULE-4-1-3" and + category = "required" +} + +module UndefinedPackage { + Query undefinedBehaviorQuery() { + //autogenerate `Query` type + result = + // `Query` type for `undefinedBehavior` query + TQueryCPP(TUndefinedPackageQuery(TUndefinedBehaviorQuery())) + } + + Query criticalUnspecifiedBehaviorQuery() { + //autogenerate `Query` type + result = + // `Query` type for `criticalUnspecifiedBehavior` query + TQueryCPP(TUndefinedPackageQuery(TCriticalUnspecifiedBehaviorQuery())) + } + + Query undefinedBehaviorAuditQuery() { + //autogenerate `Query` type + result = + // `Query` type for `undefinedBehaviorAudit` query + TQueryCPP(TUndefinedPackageQuery(TUndefinedBehaviorAuditQuery())) + } + + Query criticalUnspecifiedBehaviorAuditQuery() { + //autogenerate `Query` type + result = + // `Query` type for `criticalUnspecifiedBehaviorAudit` query + TQueryCPP(TUndefinedPackageQuery(TCriticalUnspecifiedBehaviorAuditQuery())) + } +} diff --git a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql index 9cc1ea8b9..d6186993c 100644 --- a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql +++ b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehavior.ql @@ -16,7 +16,8 @@ import cpp import codingstandards.cpp.misra -from +from Element e where - not isExcluded(x, UndefinedPackage::criticalUnspecifiedBehaviorQuery()) and -select + not isExcluded(e, UndefinedPackage::criticalUnspecifiedBehaviorQuery()) and + none() +select e, "no implementation" diff --git a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql index d3c9fe226..a92746e3f 100644 --- a/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql +++ b/cpp/misra/src/rules/RULE-4-1-3/CriticalUnspecifiedBehaviorAudit.ql @@ -17,7 +17,8 @@ import cpp import codingstandards.cpp.misra -from +from Element e where - not isExcluded(x, UndefinedPackage::criticalUnspecifiedBehaviorAuditQuery()) and -select + not isExcluded(e, UndefinedPackage::criticalUnspecifiedBehaviorAuditQuery()) and + none() +select e, "no implementation" diff --git a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql index d8662185f..5e6e224a8 100644 --- a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql +++ b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehavior.ql @@ -17,7 +17,8 @@ import cpp import codingstandards.cpp.misra -from +from Element e where - not isExcluded(x, UndefinedPackage::undefinedBehaviorQuery()) and -select + not isExcluded(e, UndefinedPackage::undefinedBehaviorQuery()) and + none() +select e, "no implementation" diff --git a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql index eb8292a43..0b4ebcc59 100644 --- a/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql +++ b/cpp/misra/src/rules/RULE-4-1-3/UndefinedBehaviorAudit.ql @@ -18,7 +18,8 @@ import cpp import codingstandards.cpp.misra -from +from Element e where - not isExcluded(x, UndefinedPackage::undefinedBehaviorAuditQuery()) and -select + not isExcluded(e, UndefinedPackage::undefinedBehaviorAuditQuery()) and + none() +select e, "no implementation"