public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107496] New: [Feature request] Conditional attributes
@ 2022-11-01 16:31 jwjagersma at gmail dot com
2022-11-01 16:50 ` [Bug c++/107496] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jwjagersma at gmail dot com @ 2022-11-01 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107496
Bug ID: 107496
Summary: [Feature request] Conditional attributes
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jwjagersma at gmail dot com
Target Milestone: ---
I'd like to request a new extension feature: the ability to enable or disable
attributes based on a conditional expression.
This could be implemented either via a sort of meta-attribute:
template <bool A, bool B>
[[gnu::conditional(A, always_inline), gnu::conditional(B, noinline)]]
auto f() { /* ... */ }
Or by reusing the template syntax:
template <bool A, bool B>
[[gnu::always_inline<A>, gnu::noinline<B>]]
auto f() { /* ... */ }
Although maybe the latter should only be allowed via the __attribute__ syntax,
which is already a GNU extension.
I did recently send in a small patch to allow selecting a string conditionally
in the i386 'target' attribute (no responses yet though). I really need it for
that particular case, and it would be nice if that could make it in gcc 13, if
there are no objections.
For the longer term though, I think being able to apply this to all attributes
would be a very useful feature to have.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/107496] [Feature request] Conditional attributes
2022-11-01 16:31 [Bug c++/107496] New: [Feature request] Conditional attributes jwjagersma at gmail dot com
@ 2022-11-01 16:50 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-01 16:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107496
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-01 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 16:31 [Bug c++/107496] New: [Feature request] Conditional attributes jwjagersma at gmail dot com
2022-11-01 16:50 ` [Bug c++/107496] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).