aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-09-12 16:01:02 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-09-12 16:01:02 +0000
commitd1463eb947cbc1033109e5142d1edcb21fe9b168 (patch)
tree6a245d08d2a9d5e8e29c972d3106de14df2314a6 /libstdc++-v3
parent5e8037ba97f4b333d7e55aad3f76bfe1c7d28239 (diff)
downloadgcc-d1463eb947cbc1033109e5142d1edcb21fe9b168.zip
gcc-d1463eb947cbc1033109e5142d1edcb21fe9b168.tar.gz
gcc-d1463eb947cbc1033109e5142d1edcb21fe9b168.tar.bz2
Fix suggestions for non-trivial Wformat type cases (PR c/72858)
gcc/c-family/ChangeLog: PR c/72858 * c-format.c (argument_parser::check_argument_type): Add params "type_start" and "conversion_char". Use the former to generate offset_to_type_start and pass it and conversion_char to check_format_types. (check_format_info_main): Capture the start of the type information as "type_start", and pass it an format_char to arg_parser.check_argument_type. (check_format_types): Provide an example in the leading comment. Add params "offset_to_type_start" and "conversion_char"; pass them to format_type_warning calls. (test_get_modifier_for_format_len): Likewise. (matching_type_p): New function. (get_format_for_type): Add param "conversion_char" and move implementation into... (get_format_for_type_1): ...new function, called twice. Use new function matching_type_p rather than checking for TYPE_CANONICAL equality. (get_corrected_substring): New function. (format_type_warning): Provide an example in the leading comment. Add params "offset_to_type_start" and "conversion_char". Replace call to get_format_for_type with call to get_corrected_substring and move rejection of hints for widths/precisions there. (assert_format_for_type_streq): Add param "conversion_char". (ASSERT_FORMAT_FOR_TYPE_STREQ): Add param CONVERSION_CHAR. (test_get_format_for_type_printf): Add conversion chars to the tests, adding coverage for various combinations of integer vs double conversions, and for preserving octal and hexadecimal conversions. (test_get_format_for_type_scanf): Add conversion chars to the tests. gcc/testsuite/ChangeLog: PR c/72858 * gcc.dg/format/diagnostic-ranges.c: Update expected suggestions to preserve conversion chars, and to preserve prefix information. * gcc.dg/format/pr72858.c: New test case. From-SVN: r240095
Diffstat (limited to 'libstdc++-v3')
0 files changed, 0 insertions, 0 deletions