eclipse-score / eclipse-score/score_cpp_policies

Add 1st draft of the compiler warning set required to support MISRA C++:2023 compliance.

Open
#42 0 comments 0 reactions 1 assignee Claimed by @nradakovic View on GitHub
compiler warnings documentation p3
Dominant language
Starlark
Stars
0
Forks
4
Avg merge
2d 16h
Merged PRs (30d)
4

Description

## Summary
This task introduces a new Bazel `cc_feature` named `misra_cpp_2023_warnings`. The feature shall enable the compiler warnings identified in the S-CORE MISRA C++:2023 Guideline Enforcement Plan (GEP) as applicable to GCC and Clang.

The initial implementation is intended as a first draft of the warning set. The mapping and selected warnings may be refined as the MISRA enforcement strategy and compiler support evolve.

## Goal
Provide a reusable Bazel C/C++ feature that enables compiler diagnostics relevant to the enforcement of MISRA C++:2023 guidelines.

The initial warning set shall be derived from the compiler-warning mappings defined in the S-CORE MISRA C++:2023 GEP:
https://github.com/eclipse-score/communication/blob/main/quality/static_analysis/misra_gep.md

The feature should provide a single, consistent entry point for enabling the MISRA C++:2023-oriented compiler warnings in supported C/C++ builds.

## Scope
The implementation should cover:
- Adding the `misra_cpp_2023_warnings` `cc_feature`
- Adding the GCC warnings identified in the MISRA C++:2023 GEP
- Adding the corresponding Clang warnings where applicable
- Handling compiler-specific warning availability appropriately
- Integrating the feature into the existing C/C++ warning policy infrastructure
- Validating the feature with representative C/C++ targets

The first draft should focus specifically on compiler warnings listed in the GEP. MISRA rules covered exclusively by CodeQL or other static-analysis tools are outside the scope of this task.

## Proposed Implementation
- Add a new `cc_feature` named `misra_cpp_2023_warnings`
- Map the warning options from the MISRA C++:2023 GEP to the corresponding compiler configuration
- Provide GCC-specific warning options where defined by the GEP
- Provide Clang-specific warning options where defined by the GEP
- Ensure unsupported compiler-specific warnings do not break toolchain configuration
- Make the feature independently selectable from other warning sets
- Integrate the feature with the existing C/C++ policy configuration

## Validation Expectations
Before closing this task, verify:
- The `misra_cpp_2023_warnings` feature is correctly recognized by the Bazel C/C++ toolchain configuration
- GCC builds successfully when the feature is enabled
- Clang builds successfully when the feature is enabled
- The expected warning options are passed to the compiler
- Compiler-specific warnings are only enabled for compilers that support them
- Representative code violating applicable MISRA-related compiler diagnostics produces the expected warnings
- The feature does not introduce unrelated compiler options
- Existing warning sets and configurations remain unaffected when the feature is not enabled

## Acceptance Criteria
- A `misra_cpp_2023_warnings` `cc_feature` is implemented
- The feature contains the first-draft set of GCC warnings identified in the S-CORE MISRA C++:2023 GEP
- The corresponding applicable Clang warnings are included
- Compiler-specific differences are handled correctly
- The feature can be enabled independently through the existing Bazel C/C++ configuration
- The implementation is validated with representative GCC and Clang builds
- The implemented warning mapping is documented and traceable to the MISRA C++:2023 GEP
- It is explicitly documented that this compiler warning set provides only partial MISRA C++:2023 enforcement and does not constitute complete MISRA compliance

## Checklist
- [ ] Review GCC warning mappings in the MISRA C++:2023 GEP
- [ ] Review Clang warning mappings in the MISRA C++:2023 GEP
- [ ] Define the initial `misra_cpp_2023_warnings` feature
- [ ] Add applicable GCC warning options
- [ ] Add applicable Clang warning options
- [ ] Handle compiler-specific warning availability
- [ ] Integrate the feature into the existing C/C++ policy configuration
- [ ] Add/extend test coverage for the feature
- [ ] Validate GCC configuration
- [ ] Validate Clang configuration
- [ ] Verify expected diagnostics with representative MISRA-related violations
- [ ] Document the initial warning mapping
- [ ] Document known gaps and rules requiring CodeQL or other static-analysis tooling

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.