[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 31 21:05:29 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016
--- Comment #42 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to qinzhao from comment #40)
> Note, our original purpose of adding this new builtin is explicitly
> described in description section as:
>
> with the new builtin, "structs can gain the counted_by attribute without
> needing additional open-coded counter assignments for each struct". that
> will ease the adoption of "counted-by" attribute in the large application
> like linux kernel.
>
> the above second code segment clearly is a open-coded usage of the
> counted-by field.
But for the kernel you'll need to have fallback code which will set the actual
counter manually for compilers without support for counted_by attribute or the
new builtin, so at least for 5-6 years it won't simplify anything, right? Just
result in larger source code. Of course, when kernel stops supporting GCC < 15
and clang < 19 or when the support would be added, it can simplify things.
More information about the Gcc-bugs
mailing list