Fix RULE-15-1-3 (non-explicit-conversion-member) findings - #1016
Open
castler wants to merge 1 commit into
Open
Conversation
castler
requested review from
LittleHuba,
bemerybmw,
crimson11,
hoe-jo and
limdor
as code owners
August 26, 2026 14:16
Resolves the RULE-15-1-3 findings in the triage database with three categories of changes: 1. Real fixes: added 'explicit' to 6 single-argument constructors that had no documented need for implicit conversion and were genuine oversights: TransactionLogLocalView, UnixDomainEngine, ProviderEventDataControlLocalView, ConsumerEventDataControlLocalView, ServiceElementMapView, RuntimeConfiguration. Updated all call sites across the codebase that relied on the now-forbidden implicit conversion to use explicit direct-initialization instead. 2. Deviations reusing existing source-comment rationale (per explicit request to check for prior justification before writing new ones): OffsetPtr's two constructors and its operator pointer() conversion (needed for basic_string compatibility and pointer-like semantics in shared memory), PolymorphicOffsetPtrAllocator's two constructors (required by the C++ Allocator named requirements), CopyableAtomic's operator T() (must mimic std::atomic's own implicit conversion), and SamplePtr's nullptr_t constructor (enables the common 'SamplePtr<T> ptr = nullptr' default-argument idiom). Each existing NOLINT/coverity rationale comment was formalized into a 'code-identifier' deviation in coding-standards.yaml paired with a '// Deviation of MISRA RULE-15-1-3' marker above the flagged code. 3. A single shared deviation for the 45 remaining findings, all of which are the compiler-generated, always-implicit conversion operator of non-capturing lambda closure types ([expr.prim.lambda.closure]). There is no source location where 'explicit' could be written for this operator, making these findings structurally unfixable without replacing the lambdas with free functions/functors purely to silence the tool. Verified: full build and all non-integration unit tests (//score/memory/shared/..., //score/message_passing/..., //score/mw/com/impl/..., runtime_configuration_test, unit_test) pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the RULE-15-1-3 (
cpp/misra/non-explicit-conversion-member) findings from the CodeQL MISRA/AUTOSAR triage.1. Real fixes (added
explicit)Added
explicitto 6 single-argument constructors that had no documented rationale for implicit conversion and were genuine oversights:TransactionLogLocalViewUnixDomainEngineProviderEventDataControlLocalViewConsumerEventDataControlLocalViewServiceElementMapViewRuntimeConfigurationUpdated all call sites across the codebase (mostly tests) that relied on the now-forbidden implicit conversion to use explicit direct-initialization instead (e.g.
TransactionLogLocalView{transaction_log}instead of= transaction_log).2. Deviations reusing existing source-comment rationale
As requested, checked for existing justification comments before writing new deviation text. The following constructors/conversion operators already had solid rationale (previously wired only to clang-tidy
NOLINT/coverity suppressions, not to CodeQL) that was reused verbatim to formalizeRULE-15-1-3deviations incoding-standards.yaml, paired with// Deviation of MISRA RULE-15-1-3marker comments in source:OffsetPtr's pointer constructor, converting constructor, andoperator pointer()(needed forbasic_string/container compatibility and pointer-like semantics in shared memory)PolymorphicOffsetPtrAllocator's two constructors (required by the C++ Allocator named requirements, e.g. rebind)CopyableAtomic::operator T()(must mimicstd::atomic's own implicit conversion)SamplePtr(std::nullptr_t)(enables theSamplePtr<T> ptr = nullptrdefault-argument idiom)3. Deviation for compiler-generated lambda closure conversions
The remaining 45 findings are all the compiler-generated, always-implicit conversion operator of non-capturing lambda closure types ([expr.prim.lambda.closure]). There is no source location where
explicitcould be written for this operator — it's entirely compiler-synthesized. Added a single shared deviation (lambda-closure-function-pointer-conversion) with marker comments above each of the 45 flagged lambda expressions.Verification
bazel build //score/memory/shared/... //score/message_passing/... //score/mw/com/...— succeeds.bazel test //score/memory/shared/... //score/message_passing/... //score/mw/com/impl/... //score/mw/com:runtime_configuration_test //score/mw/com:unit_test— all 248 non-integration unit tests pass.Note: this PR is scoped only to
eclipse-score/communication; no changes were made to the upstreamcodeql-coding-standardsquery pack.