Skip to content

Migrate compiler warning flag definitions from bazel_cpp_toolchains to score_cpp_policies #15

Description

@nradakovic

Summary

Move all compiler warning flag definitions currently owned by score_bazel_cpp_toolchains into score_cpp_policies and make toolchains consume them from this module instead of defining them on toolchain Bazel configuration module.

score_cpp_policies already acts as the central home for reusable C++ quality policy such as sanitizers and clang-tidy. Compiler warning policy should live there as well so warning levels and exceptions are defined once and reused consistently across S-CORE modules.

Problem

Warning policy is currently embedded in the toolchain templates instead of being managed as a shared policy layer. That creates a few problems:

  • Warning levels are not centrally managed alongside other C++ quality policies.
  • Consumers cannot adopt a shared warning policy independently of the toolchain implementation.
  • Exceptions such as -Wno-error=deprecated-declarations and -Wno-error=mismatched-new-delete are owned by the toolchain rather than the policy module.
  • Changing warning policy requires touching the toolchain repository instead of the policy repository.

Scope

Migrate all compiler warning-related flags from this module to score_cpp_policies, including:

  • Base warning feature groups:
    • minimal_warnings
    • strict_warnings
    • all_wall_warnings
    • warnings_as_errors
  • Language-specific warning groups:
    • C-only warning flags
    • C++-only warning flags
  • Warning suppressions and exceptions currently expressed as compiler flags, including:
    • -Wno-builtin-macro-redefined
    • -Wno-error=deprecated-declarations
    • -Wno-error=mismatched-new-delete
    • -Werror
  • Both Linux and QNX variants of the current warning policy

This should cover all -W* compiler warning flags currently defined by the toolchain templates. Non-warning compile flags, optimization flags, sysroot handling, and linker defaults are out of scope.

Expected Outcome

After this change:

  • score_cpp_policies becomes the single source of truth for compiler warning policy.
  • bazel_cpp_toolchains no longer hardcodes warning flag sets locally.
  • Linux and QNX toolchains consume warning features provided by score_cpp_policies.
  • Existing warning feature names remain usable, or a documented migration path is provided if names must change.

Proposed Approach

  1. Add warning-policy feature definitions to score_cpp_policies.
  2. Represent the current warning levels there in a form that toolchains can import or register cleanly.
  3. Update this toolchain module to wire those imported features into the Linux and QNX toolchains.
  4. Remove local warning flag definitions once consumers are switched over.
  5. Document the new integration and any required migration steps for downstream users.

Acceptance Criteria

  • All warning-related compiler flags currently defined in score_cpp_policies are migrated to score_cpp_policies.
  • No warning flag groups remain defined locally in the toolchain templates.
  • Linux toolchains still expose the current warning feature behavior after migration.
  • QNX toolchains still expose the current warning feature behavior after migration.
  • Existing example builds continue to work with the migrated warning policy.
  • Documentation explains how consumers enable warning levels after the migration.

Impact analysis

Users will need to define warning flags that we want to include.

Metadata

Metadata

Labels

compiler warningsCompiler warnings feature add or update.documentationImprovements or additions to documentationenhancementNew feature or requestp3Medium/Low - handle it within normal process

Type

Fields

No fields configured for Epic.

Projects

Status
Soon
Status
Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions