Skip to content

bazel: adopt module_template layout and policy-owned features - #625

Merged
4og merged 4 commits into
mainfrom
fb/519/injectable_warnings
Sep 30, 2026
Merged

4og merged 4 commits into
mainfrom
fb/519/injectable_warnings

Conversation

@fbaeuerle

Copy link
Copy Markdown
Contributor

Split .bazelrc into score.bazelrc/ and rename the platform configs to
score--; the bl-* names stay as aliases.

score_bazel_cpp_toolchains 1.0.0 dropped its built-in features, so bump to
1.0.3 and inject the score_cpp_policies ones. Same reason the dead names go
from COMPILER_WARNING_FEATURES. Strict warnings are now actually active,
hence the vajson number cast fix.

Closes #455
Closes #519

@github-project-automation github-project-automation Bot moved this to In Progress in BAS - Baselibs FT Sep 25, 2026
@github-actions github-actions Bot added comp-flatbuffers Related to score/flatbuffers component comp-json Related to score/json component comp-osal Related to score/os component comp-logging Related to score/mw/log component and rust frontend comp-hash Related to score/hash component comp-utils Related to score/utils comp-static_reflection_with_serialization Related to score/static_reflection_with_serialization comp-safecpp Related to score/language/safecpp c++ C++ code comp-memory Related to score/memory component comp-bitmanipulation Related to score/bitmanipulation component comp-network Related to score/network component comp-string_manipulation Related to score/string_manipulation component bazel Bazel and Starlark build files ci CI related changes labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@fbaeuerle
fbaeuerle force-pushed the fb/519/injectable_warnings branch from 2367648 to 6bb1468 Compare September 25, 2026 12:18
@github-actions github-actions Bot added comp-concurrency Related to score/concurrency and removed comp-logging Related to score/mw/log component and rust frontend labels Sep 25, 2026
@fbaeuerle
fbaeuerle force-pushed the fb/519/injectable_warnings branch 3 times, most recently from 1d65bd4 to 9af3f19 Compare September 28, 2026 06:49
@github-actions github-actions Bot added the comp-filesystem Related to score/filesystem component label Sep 28, 2026
@fbaeuerle
fbaeuerle force-pushed the fb/519/injectable_warnings branch 3 times, most recently from 58e43cf to de66e43 Compare September 29, 2026 11:27
@fbaeuerle
fbaeuerle marked this pull request as ready for review September 29, 2026 12:20
@fbaeuerle
fbaeuerle requested a review from antonkri as a code owner September 29, 2026 12:20

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Central configuration adoption and warning-feature injection remain incomplete, and touched tests lack required traceability metadata.

Review effort: Balanced
Findings: 1 High severity · 17 Medium severity · 2 Low severity

Open (20)
What changed in this PR

Migrates Baselibs toward the module_template Bazel layout and policy-owned compiler features, with related warning fixes.

Changes:

  • Splits Bazel platform, sanitizer, and lint configuration into dedicated files.
  • Renames platform configs while preserving deprecated aliases.
  • Injects warning/sanitizer features and resolves newly exposed C++ warnings.
File Description
tools/​coverage/​coverage.bazelrc Updates config name and warning exclusions.
tools/​BUILD Adds REPO.bazel to copyright checks.
score/​utils/​BUILD Removes obsolete warning features.
score/​string_manipulation/​BUILD Removes obsolete warning features.
score/​string_manipulation/​arguments/​BUILD Removes obsolete warning features.
score/​static_reflection_with_serialization/​visitor/​BUILD Updates warning feature set.
score/​static_reflection_with_serialization/​serialization/​BUILD Updates warning feature set.
score/​os/​utils/​qnx/​resource_manager/​tests/​stubs/​simple_read_function_stub.cpp Makes offset conversion explicit.
score/​os/​utils/​qnx/​resource_manager/​tests/​simple_read_function_test.cpp Makes test offsets constant.
score/​os/​utils/​qnx/​resource_manager/​src/​simple_read_function.cpp Adds explicit QNX type conversions.
score/​os/​toolchain_features.bzl Retains only the strict warning feature.
score/​os/​test/​unistdTest.cpp Updates invalid UID construction.
score/​os/​test/​socket_test.cpp Casts received message length.
score/​os/​test/​qnx/​neutrino_impl_test.cpp Adjusts signed QNX API values.
score/​os/​test/​qnx/​mman_test.cpp Adds explicit QNX handle/address casts.
score/​os/​test/​qnx/​fs_crypto_impl_test.cpp Removes an unused variable.
score/​os/​qnx/​procmgr_impl.cpp Reports the current errno.
score/​os/​mocklib/​ifaddrs_mock.cpp Casts address-family type explicitly.
score/​network/​test/​BUILD Removes obsolete warning features.
score/​network/​sock_async/​BUILD Removes obsolete warning features.
score/​network/​sock_async_udp/​BUILD Removes obsolete warning features.
score/​network/​sock_async_tcp/​BUILD Removes obsolete warning features.
score/​network/​sock_async_raw/​BUILD Removes obsolete warning features.
score/​network/​mocklib/​BUILD Removes obsolete warning features.
score/​network/​BUILD Removes obsolete warning features.
score/​memory/​BUILD Removes obsolete warning features.
score/​language/​safecpp/​toolchain_features.bzl Documents policy-owned warning features.
score/​language/​safecpp/​aborts_upon_exception/​BUILD Removes obsolete warning features.
score/​json/​internal/​parser/​vajson/​vajson_impl/​util/​number.h Makes numeric comparison promotions explicit.
score/​json/​internal/​parser/​vajson/​unit_test/​ct_vajson_v2_parsers.cpp Clarifies a parameter name.
score/​hash/​code/​sha256digest/​BUILD Removes obsolete warning features.
score/​hash/​code/​openssl/​openssl_wrapper/​BUILD Updates warning feature set.
score/​hash/​code/​openssl/​BUILD Updates warning feature set.
score/​hash/​code/​crc/​BUILD Removes obsolete warning features.
score/​hash/​code/​core/​factory/​impl/​BUILD Updates warning feature set.
score/​hash/​code/​core/​factory/​BUILD Updates warning feature set.
score/​hash/​code/​core/​BUILD Updates warning feature set.
score/​hash/​code/​common/​BUILD Updates warning feature set.
score/​hash/​BUILD Updates warning feature set.
score/​flatbuffers/​test/​generate_json_schema/​BUILD Updates documented build command.
score/​filesystem/​filestream/​file_factory_test.cpp Adds explicit UID/GID conversions.
score/​filesystem/​filestream/​file_factory_test_extra.cpp Adds explicit UID/GID conversions.
score/​concurrency/​locked_ptr_test.cpp Renames warning-triggering test variables.
score/​bitmanipulation/​BUILD Removes obsolete warning features.
score.bazelrc/​score_toolchain.bazelrc Adds platform configs and aliases.
score.bazelrc/​score_sanitizers.bazelrc Extracts sanitizer configuration.
score.bazelrc/​score_lint.bazelrc Extracts lint configuration.
REPO.bazel Enables repository warning policy.
README.md Documents renamed platform configs.
MODULE.bazel.lock Records updated dependencies and features.
MODULE.bazel Upgrades and configures C++ toolchains.
examples/​integration/​MODULE.bazel.lock Updates integration dependency resolution.
examples/​integration/​MODULE.bazel Upgrades integration toolchains.
AGENTS.md Updates Bazel configuration guidance.
.github/​workflows/​sanitizers_linux.yml Uses the renamed Linux config.
.github/​workflows/​lint.yml Uses the renamed Linux config.
.github/​workflows/​build_qnx.yml Renames QNX matrix configs.
.github/​workflows/​build_linux.yml Renames Linux matrix configs.
.bazelrc Imports the extracted Bazel configurations.
.agents/​skills/​requirements-management-skill/​test-to-requirement-linking.md Updates the documented test command.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .bazelrc
Comment thread MODULE.bazel
Comment thread MODULE.bazel
Comment on lines +22 to +26
WARNING_FEATURES = [
"@score_cpp_policies//warnings/gcc/features:minimal_warnings",
"@score_cpp_policies//warnings/gcc/features:strict_warnings",
"@score_cpp_policies//warnings/gcc/features:all_wall_warnings",
"@score_cpp_policies//warnings/gcc/features:warnings_as_errors",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, the extra_enabled_features is maybe better than the REPO.bazel and .bazelrc approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The current solution allows -Werror plus all the features in baselibs without breaking third party code compilation (because that code may emit warnings that we have zero control about).

bazel_dep(name = "score_bazel_platforms", version = "1.1.0")

bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.5.4", dev_dependency = True)
bazel_dep(name = "score_bazel_cpp_toolchains", version = "1.0.3", dev_dependency = True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Create a github issue to address this separately.

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.

I can’t create GitHub issues with the available tools in this session. Please open a separate issue for the integration-workspace warning-policy change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread score.bazelrc/score_toolchain.bazelrc
Comment thread score/os/test/socket_test.cpp
Comment thread score/os/test/unistdTest.cpp
Comment thread score/concurrency/locked_ptr_test.cpp
Comment thread score/concurrency/locked_ptr_test.cpp
score::Result<size_t> SimpleReadFunctionStub::read(const off_t offset, const size_t nbytes, uint64_t& result)
{
if ((offset * nbytes) >= data_.size())
if ((static_cast<size_t>(offset) * nbytes) >= data_.size())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this caused compilation failure due to a warning but it's an actual problem that requires a fix instead of silencing

Comment thread MODULE.bazel
# flush coverage counters (only active under --config=llvm_cov).
"@score_coverage//:enable_llvm_coverage_for_death_tests",
],
] + WARNING_FEATURES + LLVM_SANITIZER_FEATURES,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to @nradakovic it's a bad idea to inject "@score_cpp_policies//warnings/gcc/features:* to LLVM toolchain as these features are created specifically for GCC. But in this PR the LLVM-cov still works fine, so maybe it's ok 🤷‍♂️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's true, but clang ignores the unknown feature flags, so it doesn't matter much.

Comment thread REPO.bazel
# The injected flags come after a target's own copts, so enabling the warning levels globally
# would defeat the `-w` and `-Wno-error` opt-outs of third-party code. Only levels belong here;
# a REPO.bazel travels with the sources, so `warnings_as_errors` stays in .bazelrc.
repo(features = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not very familiar with the REPO.bazel.

  • How does it work when the module is sourced from a bazel registry? Does the REPO.bazel have any effect?
  • How is it better than enabling features in .bazelrc?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Check also the comment about the extra_enabled_features.

@fbaeuerle fbaeuerle Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is basically fixing the problem that we had (e.g. with googlebench) where the warning flags were also applied for the third party code (which happens when enabling features in .bazelrc), effectively this allowed removal of this workaround

I don't see how there would be a difference when consuming baselibs from bazel registry.

fbaeuerle and others added 4 commits September 30, 2026 12:04
Split the monolithic .bazelrc into score.bazelrc/ files and rename the
platform configs to the score-<os>-<cpu> scheme. The old bl-* names are
kept as aliases.

Fixes #455
The next commit activates strict_warnings, which adds -Wdouble-promotion on
Linux and -Wshadow, -Wconversion and -Wsign-conversion on QNX. The vajson
number cast promotes a float to double in the comparison and three tests
shadow an outer local or a fixture member. The rest is signedness: uid_t and
gid_t are signed on QNX, procmgr_value_current reports failure as UINT64_MAX,
and the QNX-only resource manager mixes off_t with the unsigned offset of
_xtype_offset. Cast explicitly, or take the error from errno.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
score_bazel_cpp_toolchains 1.0.0 removed its built-in features, so bump to
1.0.3 and inject the policy-owned ones via extra_known_features. Without
that the feature names silently do nothing.

The injected flags come after a target's own copts, so the warning levels
are enabled in REPO.bazel, for this repository only. warnings_as_errors
stays in .bazelrc, which is read for the root module only and keeps
-Werror out of consumers' builds.

The policy covers GCC only, so clang-tidy and llvm_cov drop strict_warnings
and warnings_as_errors. Dropping the global -strict_warnings negation from
.bazelrc activates strict warnings for the first time; it used to override
the per-target features attribute.

Closes #519

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
treat_warnings_as_errors, additional_warnings and strict_warnings_no_error
were never defined by any toolchain and were silently ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel Bazel and Starlark build files c++ C++ code ci CI related changes comp-bitmanipulation Related to score/bitmanipulation component comp-concurrency Related to score/concurrency comp-filesystem Related to score/filesystem component comp-flatbuffers Related to score/flatbuffers component comp-hash Related to score/hash component comp-json Related to score/json component comp-memory Related to score/memory component comp-network Related to score/network component comp-osal Related to score/os component comp-safecpp Related to score/language/safecpp comp-static_reflection_with_serialization Related to score/static_reflection_with_serialization comp-string_manipulation Related to score/string_manipulation component comp-utils Related to score/utils

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Migrate to injectable warning features in score_bazel_cpp_toolchains Validate and adopt the S-CORE global toolchain configuration

4 participants