Skip to content

Michaelrfairhurst/toolchain3 rule 4-1-2, deprecated features#1063

Open
MichaelRFairhurst wants to merge 11 commits intomainfrom
michaelrfairhurst/toolchain3-rule-4-1-2-deprecated-features
Open

Michaelrfairhurst/toolchain3 rule 4-1-2, deprecated features#1063
MichaelRFairhurst wants to merge 11 commits intomainfrom
michaelrfairhurst/toolchain3-rule-4-1-2-deprecated-features

Conversation

@MichaelRFairhurst
Copy link
Collaborator

Description

please enter the description of your change here

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • RULE-4-1-2
  • Queries have been modified for the following rules:
    • rule number here

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Copilot AI review requested due to automatic review settings March 2, 2026 07:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new MISRA C++:2023 RULE-4-1-2 rule package (Toolchain3) with multiple queries to detect usage of deprecated C++17 language/library features, along with unit tests and supporting CodeQL/test-stdlib stubs.

Changes:

  • Update rules.csv to assign RULE-4-1-2 to the Toolchain3 package.
  • Add Toolchain3 rule package metadata and integrate it into the exclusions/metadata plumbing.
  • Add new RULE-4-1-2 queries plus a full set of .qlref/.expected tests and supporting test-include stubs.

Reviewed changes

Copilot reviewed 59 out of 64 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
rules.csv Moves RULE-4-1-2 to the new Toolchain3 package.
rule_packages/cpp/Toolchain3.json Defines the Toolchain3 package contents (queries, metadata) for RULE-4-1-2.
cpp/misra/test/rules/RULE-4-1-2/test.cpp Test cases (COMPLIANT/NON_COMPLIANT) for all new RULE-4-1-2 queries.
cpp/misra/test/rules/RULE-4-1-2/UseOfUncaughtException.qlref Test harness reference for UseOfUncaughtException.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfUncaughtException.expected Expected results for UseOfUncaughtException.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedUnaryOrBinaryNegate.qlref Test harness reference for UseOfDeprecatedUnaryOrBinaryNegate.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedUnaryOrBinaryNegate.expected Expected results for UseOfDeprecatedUnaryOrBinaryNegate.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedTemporaryBuffers.qlref Test harness reference for UseOfDeprecatedTemporaryBuffers.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedTemporaryBuffers.expected Expected results for UseOfDeprecatedTemporaryBuffers.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStrStreamClass.qlref Test harness reference for UseOfDeprecatedStrStreamClass.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStrStreamClass.expected Expected results for UseOfDeprecatedStrStreamClass.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStdIteratorBaseClass.qlref Test harness reference for UseOfDeprecatedStdIteratorBaseClass.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStdIteratorBaseClass.expected Expected results for UseOfDeprecatedStdIteratorBaseClass.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStdAllocatorMember.qlref Test harness reference for UseOfDeprecatedStdAllocatorMember.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedStdAllocatorMember.expected Expected results for UseOfDeprecatedStdAllocatorMember.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedSharedPtrUnique.qlref Test harness reference for UseOfDeprecatedSharedPtrUnique.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedSharedPtrUnique.expected Expected results for UseOfDeprecatedSharedPtrUnique.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedRawStorageIterator.qlref Test harness reference for UseOfDeprecatedRawStorageIterator.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedRawStorageIterator.expected Expected results for UseOfDeprecatedRawStorageIterator.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedIsLiteralTypeTraits.qlref Test harness reference for UseOfDeprecatedIsLiteralTypeTraits.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedIsLiteralTypeTraits.expected Expected results for UseOfDeprecatedIsLiteralTypeTraits.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedFunctionBinderTypedefMemberAudit.qlref Test harness reference for UseOfDeprecatedFunctionBinderTypedefMemberAudit.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedFunctionBinderTypedefMemberAudit.expected Expected results for UseOfDeprecatedFunctionBinderTypedefMemberAudit.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedCHeaders.qlref Test harness reference for UseOfDeprecatedCHeaders.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedCHeaders.expected Expected results for UseOfDeprecatedCHeaders.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedAllocatorVoid.qlref Test harness reference for UseOfDeprecatedAllocatorVoid.ql.
cpp/misra/test/rules/RULE-4-1-2/UseOfDeprecatedAllocatorVoid.expected Expected results for UseOfDeprecatedAllocatorVoid.
cpp/misra/test/rules/RULE-4-1-2/RedeclarationOfStaticConstexprDataMemberAudit.qlref Test harness reference for RedeclarationOfStaticConstexprDataMemberAudit.ql.
cpp/misra/test/rules/RULE-4-1-2/RedeclarationOfStaticConstexprDataMemberAudit.expected Expected results for RedeclarationOfStaticConstexprDataMemberAudit.
cpp/misra/test/rules/RULE-4-1-2/NoexceptSpecifierThrowAudit.qlref Test harness reference for NoexceptSpecifierThrowAudit.ql.
cpp/misra/test/rules/RULE-4-1-2/NoexceptSpecifierThrowAudit.expected Expected results for NoexceptSpecifierThrowAudit.
cpp/misra/test/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructorAudit.qlref Test harness reference for ImplicitDeclarationOfCopyConstructorAudit.ql.
cpp/misra/test/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructorAudit.expected Expected results for ImplicitDeclarationOfCopyConstructorAudit.
cpp/misra/test/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructor.qlref Test harness reference for ImplicitDeclarationOfCopyConstructor.ql.
cpp/misra/test/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructor.expected Expected results for ImplicitDeclarationOfCopyConstructor.
cpp/misra/src/rules/RULE-4-1-2/UseOfUncaughtException.ql New query detecting std::uncaught_exception() usage.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedUnaryOrBinaryNegate.ql New query detecting std::unary_negate / std::binary_negate.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedTemporaryBuffers.ql New query detecting get_temporary_buffer / return_temporary_buffer.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedStrStreamClass.ql New query detecting deprecated strstream* types.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedStdIteratorBaseClass.ql New query detecting inheritance from std::iterator.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedStdAllocatorMember.ql New query detecting deprecated std::allocator members.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedSharedPtrUnique.ql New query detecting std::shared_ptr::unique().
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedRawStorageIterator.ql New query detecting std::raw_storage_iterator.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedIsLiteralTypeTraits.ql New query detecting std::is_literal_type / _v usage and specializations.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedFunctionBinderTypedefMemberAudit.ql New audit query detecting deprecated typedef members like result_type.
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedCHeaders.ql New query detecting deprecated C headers (<ccomplex>, etc.).
cpp/misra/src/rules/RULE-4-1-2/UseOfDeprecatedAllocatorVoid.ql New query detecting std::allocator<void> specialization.
cpp/misra/src/rules/RULE-4-1-2/RedeclarationOfStaticConstexprDataMemberAudit.ql New audit query detecting deprecated redeclarations/definitions of static constexpr members.
cpp/misra/src/rules/RULE-4-1-2/NoexceptSpecifierThrowAudit.ql New audit query detecting deprecated throw() exception specification form.
cpp/misra/src/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructorAudit.ql New audit query for possibly-deprecated implicit special members.
cpp/misra/src/rules/RULE-4-1-2/ImplicitDeclarationOfCopyConstructor.ql New query for definitely-deprecated implicit special members.
cpp/common/test/includes/standard-library/type_traits.h Extends test stdlib stubs for is_literal_type(_v) and is_trivially_copyable(_v).
cpp/common/test/includes/standard-library/strstream.h Extends test stdlib stubs for strstream and adds iostream alias.
cpp/common/test/includes/standard-library/memory.h Extends test stdlib stubs with deprecated allocator members, temp buffers, raw_storage_iterator, shared_ptr::unique.
cpp/common/test/includes/standard-library/functional.h Extends test stdlib stubs with deprecated typedef members and deprecated types.
cpp/common/test/includes/standard-library/ctgmath Test include stub for <ctgmath>.
cpp/common/test/includes/standard-library/cstdbool Test include stub for <cstdbool>.
cpp/common/test/includes/standard-library/cstdalign Test include stub for <cstdalign>.
cpp/common/test/includes/standard-library/complex Test include stub for <complex>.
cpp/common/test/includes/standard-library/ccomplex Test include stub for <ccomplex>.
cpp/common/src/codingstandards/cpp/types/ImplicitSpecialMemberFunctions.qll Adds shared logic for detecting deprecated implicit copy ctor/assignment cases.
cpp/common/src/codingstandards/cpp/standardlibrary/Memory.qll Adds DefaultAllocator helper class used by allocator queries.
cpp/common/src/codingstandards/cpp/exclusions/cpp/Toolchain3.qll Adds autogenerated exclusions/metadata wiring for Toolchain3 queries.
cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll Imports Toolchain3 and integrates it into the global query-metadata dispatch.
Comments suppressed due to low confidence (1)

rule_packages/cpp/Toolchain3.json:55

  • Same as above: implementation_scope is an array here, but existing package JSON uses an object. Please change to the standard object form to avoid schema/tooling issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants