substring-locations: add class format_string_diagnostic_t

Programming / Compilers / GCC - dmalcolm [138bc75d-0d04-0410-961f-82ee72b054a4] - 17 September 2018 20:31 EDT

With the addition of ranges in r263564, format_warning_at_substring_n has 10 arguments.

Reduce the number of args by bundling the shared ones into a class format_string_diagnostic_t.

gcc/c-family/ChangeLog:
- c-format.c (format_warning_at_char): Update for introduction of format_string_diagnostic_t. (format_type_warning): Likewise.

gcc/ChangeLog:
- gimple-ssa-sprintf.c (fmtwarn): Update for introduction of format_string_diagnostic_t. (fmtwarn_n): Likewise.
- substring-locations.c (format_string_diagnostic_t::format_string_diagnostic_t) New ctor. (format_warning_n_va): Convert to... (format_string_diagnostic_t::emit_warning_n_va): ...this. (format_warning_va): Convert to... (format_string_diagnostic_t::emit_warning_va): ...this. (format_warning_at_substring): Convert to... (format_string_diagnostic_t::emit_warning): ...this. (format_warning_at_substring_n): Convert to... (format_string_diagnostic_t::emit_warning_n): ...this.
- substring-locations.h (class format_string_diagnostic_t): New class. (format_warning_va): Convert to format_string_diagnostic_t::emit_warning_va. (format_warning_n_va): Convert to format_string_diagnostic_t::emit_warning_n_va. (format_warning_at_substring): Convert to format_string_diagnostic_t::emit_warning. (format_warning_at_substring_n): Convert to format_string_diagnostic_t::emit_warning_n.

995dda73821 substring-locations: add class format_string_diagnostic_t
gcc/ChangeLog | 26 +++++++++++
gcc/c-family/ChangeLog | 6 +++
gcc/c-family/c-format.c | 28 ++++++------
gcc/gimple-ssa-sprintf.c | 16 ++++---
gcc/substring-locations.c | 113 +++++++++++++++++++++++-----------------------
gcc/substring-locations.h | 74 +++++++++++++++---------------
6 files changed, 147 insertions(+), 116 deletions(-)

Upstream: gcc.gnu.org


  • Share