On Wed, Oct 02, 2024 at 11:48:16AM -0400, Marek Polacek wrote:
> > +      error_at (DECL_SOURCE_LOCATION (field_decl),
> > +           "argument %qE to the %qE attribute is not a field declaration"
> > +           " in the same structure as %qD", fieldname,
> > +           (get_attribute_name (attr_counted_by)),
> 
> Why use get_attribute_name when we know it must be "counted_by"?  And below
> too.

There might be a reason if the message would be used by multiple
spots with different attributes and the other uses would need that %qE,
rather than say %qs or %<counted_by%> (to make it easier for translators).
If the message is only for this attribute, just use %<counted_by%>, or
if it would be for several attributes but in each case you'd know the name
as constant literal, %qs with "counted_by" operand would be best.

That said, the ()s around the call are also superfluous, so if it isn't
changed, it should be just
                get_attribute_name (attr_counted_by),

        Jakub

Reply via email to