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

--- Comment #2 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #1)
> Does this happen with the c++ frontend? Or only the c frontend?

Does this mean just build the file with cc1plus or use the new style of
attribute specifier ?

For latter it reports issue, despite a local fix which cures the c test above.

../../build/x86-gcc-1-dwarf-fix/gcc/cc1plus -quiet -O2 -gdwarf pr125991-cpp.C
pr125991-cpp.C:8:12: warning: attribute ignored [-Wattributes]
    8 | struct msr [[gnu::btf_type_tag ("percpu")]] *msrs_alloc(void);
      |            ^
pr125991-cpp.C:8:12: note: an attribute that appertains to a type-specifier is
ignored


> There are interesting rules about where gnu attributes will apply to return
> types vs the function decl vs the function type.

Ah interesting and those are documented ? In developer's guide section.

> So it night be clang not implementing those rules the same as gcc.
> 
> Note __attribute__ is a gnu extension first. Even though the attribute was
> added for clang first.

Understood. The practical issue / challenge here is clang took the lead and
implemented some things which now stick in bpf world. Not suggesting we
implement absurdities but lets get somewhere in the middle and at least do
reasonable things.

Reply via email to