Skip to content

Fix -Wextra and -Wpedantic warnings in the headers - #2373

Merged
ericniebler merged 1 commit into
NVIDIA:mainfrom
veljjanoski:fix-header-warnings
Oct 30, 2026
Merged

ericniebler merged 1 commit into
NVIDIA:mainfrom
veljjanoski:fix-header-warnings

Conversation

@veljjanoski

Copy link
Copy Markdown
Contributor

Fixes #1116.

What

The tests build with -Wall -Wextra -Wpedantic -Werror, but CMake adds the headers as SYSTEM, so the tests never see warnings inside them. Users who include the headers with a plain -I still get those warnings, for example through meson's include_directories('include') with warning_level=3. On main, building the tests with the headers through -I gives 23 warning sites with GCC 12 and 9 with Clang 21. This PR fixes them:

  • 19 extra ; after member function definitions, in 16 files (GCC -Wpedantic).
  • -Wmissing-field-initializers (GCC and Clang): __continues_on's __state_base::__data_ and __finally's __opstate_base::__result_ get a {} default member initializer. Both structs are only built by aggregate initialization that leaves this member out, so it was already initialized from {}. Behaviour does not change.
  • -Wunused-local-typedef(s): an unused shape_t alias in thread_pool_base.hpp.
  • Clang -Wmissing-braces in __when_all.hpp: ignored for the file after __prologue.hpp, as __bulk.hpp, __just.hpp and __tuple.hpp already do.
  • -Wunused-value in __receiver_ref.hpp: ignored for the file the same way, as exec/repeat_n.hpp does. The left operand of the comma in __indirect_receiver::set_next has no effect, but it stays, because it is what makes the call depend on _Item.

In thread_pool_base.hpp, _bulk_sender::connect ends with STDEXEC_AUTO_RETURN(...). Without the ;, clang-format treats the next member as part of connect, so connect and the next member are now inside // clang-format off/on, as in basic_sequence.hpp.

Not changed: GCC -Wsubobject-linkage at 4 places in __any.hpp. GCC reports it when the tests instantiate those templates with types from an anonymous namespace.

Verification

Docker (Debian 12), GCC 12.2 and Clang 21.1 with libstdc++ 12, Debug, the tests' own flags, with the headers through -I instead of -isystem. The GCC build also had -Wno-error=subobject-linkage.

Warning sites in the headers main (9d292a4) this PR
GCC 12 23, plus 4 subobject-linkage 0, plus the same 4
Clang 21 9 0

With this PR, test.stdexec and test.exec build with -Werror and pass with both compilers. That is 641 and 454 test cases with Clang. GCC runs one fewer in test.stdexec, because one test is skipped on GCC.

Each header in include/stdexec and include/exec was also compiled on its own with both compilers (-fsyntax-only -Wall -Wextra -Wpedantic, through -I). This skipped the nvexec, asio, tbb, taskflow, libdispatch and Windows headers. Only the deprecation #warnings in exec/repeat_effect_until.hpp and exec/system_context.hpp remain. clang-format 21 is clean.

Not tested: MSVC, nvc++, Release builds, and the other CI configurations.

These warnings came back because the tests cannot see them. If you want, I can follow up with a change that builds the tests with the headers as non-system includes, so CI catches new ones. GCC would need -Wno-subobject-linkage for that.

AI-usage disclosure: Claude (Anthropic) was used as assistant.

@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test a3eee61

@ericniebler
ericniebler merged commit 33da503 into NVIDIA:main Oct 30, 2026
67 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Would you consider cleaning up gcc warnings with -Wextra and -Wpedantic?

2 participants