[Bug c++/39159] unhelpful attribute warning on matching declaration after definition

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 8 16:27:00 GMT 2016


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

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm not an expert in this area but the approach seems reasonable to me.  I
didn't test it in 5.x but with 6.0, it doesn't make a difference because
simple_cst_equal() cannot compare TREE_LISTs.  Using attribute_value_equal()
instead does work.

>From a user's point of view, though, it would be helpful if the diagnostic
included the names of the "new" attributes that are being ignored, and pointed
to the location of the previous "old" declaration that the current one
conflicts with.  The former should be a matter of concatenating the names of
the new attributes into a string and making that part of the warning.  The
latter can be done by calling:

  inform (DECL_SOURCE_LOCATION (TYPE_FIELDS (*anode)), "previous declaration
here");

To get the patch reviewed and ultimately approved, you should rebase it to the
current trunk, add tests and ChangeLog entries, and post it to gcc-patches.


More information about the Gcc-bugs mailing list