Conversation
ispeters
force-pushed
the
address-unused-attribute
branch
from
October 2, 2026 14:00
9fc7f6b to
cc533d2
Compare
ericniebler
reviewed
Oct 2, 2026
| #if defined(_LIBCPP_VERSION) && STDEXEC_CLANG() | ||
| # define STDEXEC_NAMESPACE_STD_BEGIN \ | ||
| STDEXEC_PRAGMA(GCC diagnostic push) \ | ||
| STDEXEC_PRAGMA(GCC diagnostic ignored "-Wpragma-clang-attribute") \ |
Collaborator
There was a problem hiding this comment.
Why are we suppressing GCC warnings in a block guarded by STDEXEC_CLANG()? And why are we not using STDEXEC_PRAGMA_PUSH(), STDEXEC_PRAGMA_POP() and STDEXEC_PRAGMA_IGNORE_GNU("-Wpragma-clang-attribute")?
Contributor
Author
There was a problem hiding this comment.
Why are we suppressing GCC warnings in a block guarded by
STDEXEC_CLANG()?
No particular reason, I suppose. I'll change it.
And why are we not using
STDEXEC_PRAGMA_PUSH(),STDEXEC_PRAGMA_POP()andSTDEXEC_PRAGMA_IGNORE_GNU("-Wpragma-clang-attribute")?
That's answered in the final two lines of the comment before the definition:
// This uses STDEXEC_PRAGMA directly rather than STDEXEC_PRAGMA_PUSH() and friends
// because those are defined further down, after the first use of these macros below.Did you miss that, or find it not compelling?
When building stdexec with Clang and libc++ version 23+, `-Wpragma-clang-attribute` causes many errors that look like this: ``` error: unused attribute '__visibility__' in '#pragma clang attribute push' region [-Werror,-Wpragma-clang-attribute] ``` attributable to uses of the `STDEXEC_NAMESPACE_STD_BEGIN` macro. stdexec only uses that macro to forward-declare non-functions, and the attribute is only applicable to functions, so the warning fires on every region where stdexec forward-declares things in `std`. This diff addresses the problem by modifying the `STDEXEC_NAMESPACE_STD_BEGIN`/`_END` macros to push and pop a `-Wno-pragma-clang-attribute` setting around the region whenever building with Clang and libc++. GCC also fails when building with libc++ version 23+, but the failure is because GCC doesn't recognize the `#pragma clang attribute push` pragma and so fails with an unsuppressable warning-as-error; the tip of `main` in libc++ resolves this problem by only emitting the pragma when compiling with Clang.
ispeters
force-pushed
the
address-unused-attribute
branch
from
October 2, 2026 16:38
cc533d2 to
3711250
Compare
Collaborator
|
/ok to test 3711250 |
Collaborator
|
/ok to test e9d7af3 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When building stdexec with Clang and libc++ version 23+,
-Wpragma-clang-attributecauses many errors that look like this:attributable to uses of the
STDEXEC_NAMESPACE_STD_BEGINmacro. stdexec only uses that macro to forward-declare non-functions, and the attribute is only applicable to functions, so the warning fires on every region where stdexec forward-declares things instd.This diff addresses the problem by modifying the
STDEXEC_NAMESPACE_STD_BEGIN/_ENDmacros to push and pop a-Wno-pragma-clang-attributesetting around the region whenever building with Clang and libc++. GCC also fails when building with libc++ version 23+, but the failure is because GCC doesn't recognize the#pragma clang attribute pushpragma and so fails with an unsuppressable warning-as-error; the tip ofmainin libc++ resolves this problem by only emitting the pragma when compiling with Clang.