On 05/18/2016 06:12 PM, Martin Sebor wrote:
The bug points out that the following and similar invalid uses
of NULL are not diagnosed.

  #include <stddef.h>

  const char* a[1] = { "", NULL };

The attached patch implements the suggestion on the Diagnostics
Guidelines Wiki to call
expansion_point_location_if_in_system_header to determine the
location where the macro is used.  Making these changes and
noticing the already existing calls to the function made me
wonder if this approach (warning on system macros) should be
the default strategy, and not warning special.  Aren't there
many more contexts where we would like to see warnings for
them?
Seems like it would be a good idea. Our ability to track this kind of stuff has improved greatly over the last several years and a rethink of stuff like this is in order.


In comment #8 on the bug Manuel also suggests to remove the note:
(near initialization for 'decl').  I tried it but decided not to
include it in this change because of the large number of tests it
will require making changes to (I counted at least 20).  I think
it's a worthwhile change but it seems that it might better be
made on its own.
Yes, that seems like a separate change.

As for the patch, it's fine for the trunk. I note that the BZ entry claims this is a regression since 4.8, so rather than close, just remove the "7" from the regression marker.

Jeff

Reply via email to