On Tue, May 25, 2021 at 2:53 AM Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On 5/24/21 5:08 PM, David Malcolm wrote: > > On Mon, 2021-05-24 at 16:02 -0600, Martin Sebor wrote: > >> The rare expressions that have no location > >> continue to have just one bit[1]. > > > > Where does this get stored? I see the final patch in the kit removes > > TREE_NO_WARNING, but I don't quite follow the logic for where the bit > > would then be stored for an expr with UNKNOWN_LOCATION. > > The patch just removes the TREE_NO_WARNING macro (along with > the gimple_no_warning_p/gimple_set_no_warning) functions but not > the no-warning bit itself. It removes them to avoid accidentally > modifying the bit alone without going through the new API and > updating the location -> warning group mapping. The bit is still > needed for expression/statements with no location.
I wonder if we could clone UNKNOWN_LOCATION, thus when we set_no_warning on UNKNOWN_LOCATION create a new location with the source location being still UNKNOWN but with the appropriate ad-hoc data to disable the warning? That of course requires the API to be location_t set_no_warning (...) and users would need to update the container with the new location (or we'd need to use a reference we can update in set_no_warning). That said - do you have any stats on how many UNKNOWN_LOCATION locations we run into with boostrap / the testsuite? Otherwise thanks for tackling this long-standing issue. Richard.