[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent
kees at outflux dot net
gcc-bugzilla@gcc.gnu.org
Tue Jul 30 17:28:09 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016
--- Comment #32 from Kees Cook <kees at outflux dot net> ---
(In reply to qinzhao from comment #29)
> (In reply to Jakub Jelinek from comment #28)
> > Speaking of counted_by, I see support for it in c-family/ and c/, but not in
> > cp/ at all, what is the attribute supposed to do in C++?
> The initial plan is to support it in both C and C++ (since C++ can use
> flexible array member too through GCC extension), but I didn't implement it
> in C++ in the initial patch.
> > If it isn't supported, it should be documented that it doesn't apply to C++
> > and should be rejected in C++. If it is to be supported, the support
> > (including support for templates) needs to be there before GCC 15.
> I will try to support it in C++ too in GCC15. If not, I will update the
> documentation to indicate this limitation.
FWIW, the Linux kernel only needs this for C (obviously), so if C++ support is
at all a burden, my vote would to be having these features be C-only. (But from
a completeness perspective, it would be nice to have it in C++ too.)
More information about the Gcc-bugs
mailing list