Don't suppress bogus usage of macros from system headers in -Wformat (PR c/78304)
commit2d9cba1ec16cd7cb27b2a61f38675be328d9c708
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Jan 2017 19:27:43 +0000 (13 19:27 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Jan 2017 19:27:43 +0000 (13 19:27 +0000)
tree1ba8193ad64aa0c109a78cb075770c0922917e6f
parent6ab6fcab7c5ab84b53404f3e67ef2f13f93404d7
Don't suppress bogus usage of macros from system headers in -Wformat (PR c/78304)

gcc/ChangeLog:
PR c/78304
* substring-locations.c (format_warning_va): Strengthen case 1 so
that both endpoints of the substring must be within the format
range for just the substring to be printed.

gcc/testsuite/ChangeLog:
PR c/78304
* gcc.dg/format/diagnostic-ranges.c (test_macro): Undef INT_FMT.
(test_macro_2): New test.
(test_macro_3): New test.
(test_macro_4): New test.
(test_non_contiguous_strings): Convert line number to line offset.
* gcc.dg/format/pr78304-2.c: New test case.
* gcc.dg/format/pr78304.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244453 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/substring-locations.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
gcc/testsuite/gcc.dg/format/pr78304-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/pr78304.c [new file with mode: 0644]