PR translation/90156 - add linter check suggesting to replace %<%s%> with %qs
authorMartin Sebor <msebor@redhat.com>
Wed, 19 Jun 2019 19:08:24 +0000 (19:08 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 19 Jun 2019 19:08:24 +0000 (13:08 -0600)
commita04c0734e366a167a55f635b7d09de09b5013051
treeb96003c3241a11305bffd62138ebc12d78091107
parentef3e6aa32043fd8a285342aa6c668b636f5f0d41
PR translation/90156 - add linter check suggesting to replace %<%s%> with %qs

gcc/c-family/ChangeLog:

PR translation/90156
* c-format.c (function_format_info::format_type): Adjust type.
(function_format_info::is_raw): New member.
(decode_format_type): Adjust signature.  Handle "raw" diag attributes.
(decode_format_attr): Adjust call to decode_format_type.
Avoid a redundant call to convert_format_name_to_system_name.
Avoid abbreviating the word "arguments" in a diagnostic.
(format_warning_substr): New function.
(avoid_dollar_number): Quote dollar sign in a diagnostic.
(finish_dollar_format_checking): Same.
(check_format_info): Same.
(struct baltoks_t): New.
(c_opers, c_keywords, cxx_keywords, badwords, contrs): New arrays.
(maybe_diag_unbalanced_tokens, check_tokens, check_plain): New
functions.
(check_format_info_main): Call check_plain.  Use baltoks_t.  Call
maybe_diag_unbalanced_tokens.
(handle_format_attribute): Spell out the word "arguments" in
a diagnostic.

gcc/testsuite/ChangeLog:

PR translation/90156
* gcc.dg/format/gcc_diag-11.c: Enable.

From-SVN: r272483
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/gcc_diag-11.c