https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016

--- Comment #35 from qinzhao at gcc dot gnu.org ---
(In reply to Bill Wendling from comment #33)
> 
> We could then have a builtin to get the attribute's argument:
> 
>   __builtin_get_attr_arg (ptr, attr_name);

not sure whether it's worth the effort to provide this general builtin or not
for all the attributes. the main question is, what's the exact attribute's
argument for each of the attributes that the compiler provided.

But, I think it's a good idea to further simplify the functionality of the new
builtin __builtin_get_counted_by (P->FAM) by eliminating the check for whether
"P->FAM) has the counted_by attribute, instead, this new builtin assumes that
"P->FAM" has the counted_by attribute, just return the corresponding counted_by
field.

Then, the user needs to write the following:

if (__builtin_has_attribute (P->FAM, counted_by))
   *__builtin_get_counted_by (P->FAM) = COUNT

Reply via email to