Skip to content

Fix RULE-15-1-3 (non-explicit-conversion-member) findings - #1016

Open
castler wants to merge 1 commit into
eclipse-score:mainfrom
castler:js_fix_rule_15_1_3_non_explicit_conversion
Open

Fix RULE-15-1-3 (non-explicit-conversion-member) findings#1016
castler wants to merge 1 commit into
eclipse-score:mainfrom
castler:js_fix_rule_15_1_3_non_explicit_conversion

Conversation

@castler

@castler castler commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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 explicit to 6 single-argument constructors that had no documented rationale for implicit conversion and were genuine oversights:

  • TransactionLogLocalView
  • UnixDomainEngine
  • ProviderEventDataControlLocalView
  • ConsumerEventDataControlLocalView
  • ServiceElementMapView
  • RuntimeConfiguration

Updated 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 formalize RULE-15-1-3 deviations in coding-standards.yaml, paired with // Deviation of MISRA RULE-15-1-3 marker comments in source:

  • OffsetPtr's pointer constructor, converting constructor, and operator pointer() (needed for basic_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 mimic std::atomic's own implicit conversion)
  • SamplePtr(std::nullptr_t) (enables the SamplePtr<T> ptr = nullptr default-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 explicit could 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 upstream codeql-coding-standards query pack.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant