Skip to content

Treat compiler warnings as errors - #286

Open
mattday-etas wants to merge 2 commits into
eclipse-score:mainfrom
etas-contrib:treat-compiler-warnings-as-errors
Open

mattday-etas wants to merge 2 commits into
eclipse-score:mainfrom
etas-contrib:treat-compiler-warnings-as-errors

Conversation

@mattday-etas

Copy link
Copy Markdown

This enables the compiler flags -Wall, -Wextra and -Werror for the code in the time repository. Any warnings produced by external code are still permitted.

To enable the change, two small fixes were required for lines producing compiler warnings:

  1. -Wredundant-move (return std::move(data); in verification_stage.h)
    • Returning a local by value already lets the compiler move it, or skip the copy entirely (NRVO). An explicit std::move is redundant, and it can block that elision.
    • Fix: return data;.
  2. -Wclass-memaccess (memcpy into GptpIpcRegion in the test)
    • memcpy onto an object whose type isn't trivially copyable can bypass its copy semantics, so GCC warns. Here, the test deliberately overwrites the first 4 bytes (the magic number) to simulate corruption.
    • Fix: cast the destination to void* so GCC sees raw-byte writes, which is what the test intends. Behavior is unchanged.

@github-actions

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: d6f9b662-b3ea-4b3e-9b7b-751c63605a48
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'platforms', the root module requires module version platforms@1.0.0, but got platforms@1.1.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_oci', the root module requires module version rules_oci@2.2.7, but got rules_oci@2.3.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: /home/runner/.bazel/external/score_baselibs+/score/json/BUILD:24:12: target '@@score_baselibs+//score/json:base_library' is deprecated: base_library no longer has any effect, vaJson is the only parser backend. Remove this flag from your build configuration; it will be deleted in a future release.
Computing main repo mapping: 
Loading: 
Loading: 3 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:license-check': no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/time/time/BUILD
ERROR: no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/time/time/BUILD
INFO: Elapsed time: 15.104s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

Comment thread .bazelrc

# Treat compiler warnings as errors for this repository's own code only
# (external dependencies are excluded via the path-based regex).
build --per_file_copt=^score/.*,^examples/.*@-Wall,-Wextra,-Werror

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use the enforcement from score_cpp_policies?

@github-actions

Copy link
Copy Markdown
Contributor

Quality pack traceability report for this pull request:

Status: PASS (workflow run)

Traceability gate input: /home/runner/work/time/time/_build/metrics.json
------------------------------------------------------------------------
[comp_req]
  Requirements with source links: 9/58 (15.52%)
  Requirements with test links:   5/58 (8.62%)
  Requirements fully linked:      5/58 (8.62%)
  Tests linked to requirements:   8/441 (1.81%)
  Broken test references:         0
------------------------------------------------------------------------
Threshold check passed.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-286: https://eclipse-score.github.io/time/pr-286/

This branch was successfully deployed

1 active deployment
workflow-approval — bb17fadc Deployed Oct 29, 2026 by mattday-etas via qnx-build (arm64-qnx) / approval #1123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants