Simplify format_warning_at_substring API
commit3a010afa0b6972f8eec6c5f99ecd9fb445a13bc1
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Oct 2017 19:41:01 +0000 (17 19:41 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Oct 2017 19:41:01 +0000 (17 19:41 +0000)
tree6ce19e9d8c4044bd590ad1020c56f9554ed8559c
parente4ef7d73d8a084f5c799d8dcde7a874a1a4e611e
Simplify format_warning_at_substring API

The format_warning_at_substring API has a rather clunk way of indicating
the location of the pertinent param (if any): a source_range * is passed
in, which can be NULL.  Doing so requires extracting a range from the
location_t and passing around a pointer to it, or NULL, as needed.

This patch simplifies things by eliminating the source_range * in
favor of a location_t, with UNKNOWN_LOCATION used to signify that
no param location is available.

gcc/c-family/ChangeLog:
* c-format.c (format_warning_at_char): Pass UNKNOWN_LOCATION
rather than NULL to format_warning_va.
(check_format_types): Likewise when calling format_type_warning.
Remove code to extract source_ranges and source_range * in favor
of just a location_t.
(format_type_warning): Convert source_range * param to a
location_t.

gcc/ChangeLog:
* gimple-ssa-sprintf.c (fmtwarn): Update for changed signature of
format_warning_at_substring.
(maybe_warn): Convert source_range * param to a location_t.  Pass
UNKNOWN_LOCATION rather than NULL to fmtwarn.
(format_directive): Remove code to extract source_ranges and
source_range * in favor of just a location_t.
(parse_directive): Pass UNKNOWN_LOCATION rather than NULL to
fmtwarn.
* substring-locations.c (format_warning_va): Convert
source_range * param to a location_t.
(format_warning_at_substring): Likewise.
* substring-locations.h (format_warning_va): Likewise.
(format_warning_at_substring): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253827 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/gimple-ssa-sprintf.c
gcc/substring-locations.c
gcc/substring-locations.h