Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cpp/autosar/src/rules/A9-5-1/UnionKeywordUsedAutosarCpp.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @id cpp/autosar/union-keyword-used-autosar-cpp
* @name A9-5-1: Unions shall not be used
* @description Unions shall not be used. Tagged unions can be used if 'std::variant' is not
* available.
Comment on lines +2 to +5
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This PR replaces existing AUTOSAR queries (including changing/removing previous @ids) rather than only adding new queries. That changes the released artifacts layout, so a change note should be added under change_notes/ (per docs/development_handbook.md) and the PR checklist updated accordingly.

Copilot uses AI. Check for mistakes.
* @kind problem
* @precision very-high
* @problem.severity error
* @tags external/autosar/id/a9-5-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
*/

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.rules.unionkeywordused.UnionKeywordUsed

module UnionKeywordUsedAutosarCppConfig implements UnionKeywordUsedConfigSig {
Query getQuery() { result = BannedSyntaxPackage::unionKeywordUsedAutosarCppQuery() }
}

import UnionKeywordUsed<UnionKeywordUsedAutosarCppConfig>
41 changes: 0 additions & 41 deletions cpp/autosar/src/rules/A9-5-1/UnionsUsed.ql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @id cpp/autosar/bit-fields-should-not-be-declared-autosar-cpp
* @name A9-6-2: Bit-fields shall be used only when interfacing to hardware or conforming to communication protocols
* @description The usage of bit-fields increases code complexity and certain aspects of bit-field
* manipulation can be error prone and implementation defined. Hence a bit-field usage
* is reserved only when interfacing to hardware or conformance to communication
* protocols.
* @kind problem
* @precision very-high
* @problem.severity recommendation
* @tags external/autosar/id/a9-6-2
* maintainability
* external/autosar/allocated-target/design
* external/autosar/enforcement/partially-automated
* external/autosar/obligation/required
*/

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.rules.bitfieldsshallbeusedonlywheninterfacingtohardwareorconformingtocommunicationprotocols.BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols

module BitFieldsShouldNotBeDeclaredAutosarCppConfig implements
BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocolsConfigSig
{
Query getQuery() { result = RepresentationPackage::bitFieldsShouldNotBeDeclaredAutosarCppQuery() }
}

import BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols<BitFieldsShouldNotBeDeclaredAutosarCppConfig>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/unionkeywordused/UnionKeywordUsed.ql
1 change: 1 addition & 0 deletions cpp/autosar/test/rules/A9-5-1/UnionsUsed.testref
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/unionkeywordused/UnionKeywordUsed.ql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/bitfieldsshallbeusedonlywheninterfacingtohardwareorconformingtocommunicationprotocols/BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols.ql
Loading
Loading