On Fri, 2020-12-04 at 10:58 +0100, Erick Ochoa wrote:
> +         // Anonymous fields? (Which the record can be!).
> +           warning (OPT_Wdfa, "RECORD_TYPE %qE has dead field %qE in LTO.\n",
> +               record, field);

Others have pointed out that -Wdfa isn't a good name for the warning, I
like their suggestions.

A few other nitpicks on this:

- "RECORD_TYPE" is an implementation detail of GCC.  Diagnostics should
be worded in terms of the user’s source code, and the source language,
rather than GCC’s own implementation details.

- "dead field" feels like jargon to me.

How about:
  field 'foo' in 'struct bar' is never used [-Wunused-field]
or somesuch?

- The "in LTO" in the message seems like a redundant implementation
detail to me.

- "warning" will implicitly use the global "input_location" as the
location of the diagnostic.  Better would be to use "warning_at" with
the location of the field's declaration.  I think you can get this via
DECL_SOURCE_LOCATION () on the FIELD_DECL.


See also:
  https://gcc.gnu.org/onlinedocs/gccint/Guidelines-for-Diagnostics.html


Hope this is constructive
Dave

Reply via email to