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.