diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-09-17 20:31:01 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-09-17 20:31:01 +0000 |
commit | c896ecfeab0658dc61ed0a9ad4b649c69d1d8679 (patch) | |
tree | c755d1e0d94404c15b74070d31c234e3d0d6d0e6 /gcc/gimple-ssa-sprintf.c | |
parent | 69d7aabfd8fec442047cefb136b1fd2680310fa9 (diff) | |
download | gcc-c896ecfeab0658dc61ed0a9ad4b649c69d1d8679.zip gcc-c896ecfeab0658dc61ed0a9ad4b649c69d1d8679.tar.gz gcc-c896ecfeab0658dc61ed0a9ad4b649c69d1d8679.tar.bz2 |
substring-locations: add class format_string_diagnostic_t
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.
From-SVN: r264372
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r-- | gcc/gimple-ssa-sprintf.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 9f3eebc..9b6f6e6 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -455,7 +455,8 @@ get_format_string (tree format, location_t *ploc) } /* For convenience and brevity, shorter named entrypoints of - format_warning_at_substring and format_warning_at_substring_n. + format_string_diagnostic_t::emit_warning_va and + format_string_diagnostic_t::emit_warning_n_va. These have to be functions with the attribute so that exgettext works properly. */ @@ -464,10 +465,11 @@ ATTRIBUTE_GCC_DIAG (5, 6) fmtwarn (const substring_loc &fmt_loc, location_t param_loc, const char *corrected_substring, int opt, const char *gmsgid, ...) { + format_string_diagnostic_t diag (fmt_loc, NULL, param_loc, NULL, + corrected_substring); va_list ap; va_start (ap, gmsgid); - bool warned = format_warning_va (fmt_loc, NULL, param_loc, NULL, - corrected_substring, opt, gmsgid, &ap); + bool warned = diag.emit_warning_va (opt, gmsgid, &ap); va_end (ap); return warned; @@ -479,12 +481,12 @@ fmtwarn_n (const substring_loc &fmt_loc, location_t param_loc, const char *corrected_substring, int opt, unsigned HOST_WIDE_INT n, const char *singular_gmsgid, const char *plural_gmsgid, ...) { + format_string_diagnostic_t diag (fmt_loc, NULL, param_loc, NULL, + corrected_substring); va_list ap; va_start (ap, plural_gmsgid); - bool warned = format_warning_n_va (fmt_loc, NULL, param_loc, NULL, - corrected_substring, - opt, n, singular_gmsgid, plural_gmsgid, - &ap); + bool warned = diag.emit_warning_n_va (opt, n, singular_gmsgid, plural_gmsgid, + &ap); va_end (ap); return warned; |