Skip to content

Fix two warnings that fail Clang builds with warnings as errors - #8197

Merged
hkaiser merged 1 commit into
masterfrom
fix-clang-werror
Nov 22, 2026
Merged

hkaiser merged 1 commit into
masterfrom
fix-clang-werror

Conversation

@hkaiser

@hkaiser hkaiser commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Two warnings fail Clang 23 builds with warnings as errors:

  • invoke_callback in post_implementations_fwd.hpp doesn't use its std::error_code parameter when HPX_WITH_NETWORKING=OFF (-Wunused-parameter). It is now [[maybe_unused]].
  • command_line_handling::preprocess_config_settings used std::stable_partition on a vector of strings. libstdc++ 12 implements it with std::get_temporary_buffer, which is deprecated, and Clang 23 reports that when the template is instantiated from HPX code (-Wdeprecated-declarations). The function now copies the --hpx: options with std::ranges::copy_if and removes them with std::erase_if, which keeps the order of both parts as before.

Both builds (networking off and on) were checked with Clang 23 and GCC 12 with warnings as errors.

invoke_callback doesn't use its error code without networking; mark it
[[maybe_unused]]. command_line_handling::preprocess_config_settings
used std::stable_partition on strings, whose implementation in
libstdc++ 12 calls the deprecated std::get_temporary_buffer, which
Clang 23 reports when the template is instantiated; copy the command
line options and erase them from the settings instead, keeping the
order of both.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@hkaiser hkaiser added this to the 2.1.0 milestone Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Configuration preprocessing now treats an entry as an HPX option only when it begins with the exact --hpx: prefix. Entries that contain --hpx: elsewhere remain configuration entries, avoiding unintended option extraction. The order of extracted options and remaining configuration entries is preserved.

The changes update how configuration entries with the --hpx: prefix are extracted. They also mark an error-code parameter in an invoke_callback overload as potentially unused.

Changes: Configuration option extraction

Layer / File(s) Summary
Extract prefixed options
libs/core/command_line_handling_local/src/command_line_handling_local.cpp
The function copies entries beginning with --hpx: into the options list, then erases them from the configuration entries. Both resulting collections retain their relative order.

Callback parameter annotation

Layer / File(s) Summary
Annotate error-code parameter
libs/full/async_distributed/include/hpx/async_distributed/detail/post_implementations_fwd.hpp
The error-code overload of invoke_callback marks ec as [[maybe_unused]]. Its callback behavior is unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: msimberg

Merge Risk: Minimal · up to fb981

This change fixes two Clang warnings-as-errors build failures without altering runtime behavior. The option extraction keeps the same ordering and the annotation has no behavioral effect. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names two concrete changes: fixing two Clang warnings that fail builds with warnings as errors. The changeset contains both fixes: the [[maybe_unused]] marking of the std::error_code paramet…
Description check Passed The description states the two warnings, the affected functions, the cause of each warning, and the fix for each. It also lists the build configurations tested. This matches the changeset in post_impl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two concrete changes: fixing two Clang warnings that fail builds with warnings as errors. The changeset contains both fixes: the [[maybe_unused]] marking of the std::error_code parameter in invoke_callback, and the replacement of std::stable_partition with std::ranges::copy_if and std::erase_if in preprocess_config_settings. The title is specific enough to convey the primary change, though it does not name the affected functions.

Full details: Description check

Explanation

The description states the two warnings, the affected functions, the cause of each warning, and the fix for each. It also lists the build configurations tested. This matches the changeset in post_implementations_fwd.hpp and command_line_handling_local.cpp.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bfd1d03e-6835-4a3d-8812-5c94d8a7fd38
Commits

Reviewing files that changed from the base of the PR and between 68c527c and fb981f0.

Files selected for processing: 2

  • libs/core/command_line_handling_local/src/command_line_handling_local.cpp
  • libs/full/async_distributed/include/hpx/async_distributed/detail/post_implementations_fwd.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@hkaiser
hkaiser merged commit 5d08dcd into master Nov 22, 2026
135 checks passed
@hkaiser
hkaiser deleted the fix-clang-werror branch November 22, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant