diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-01-13 19:27:43 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-01-13 19:27:43 +0000 |
commit | be4aa83d6ff4720fffd2c9f62c6e3082ece1937f (patch) | |
tree | 1ba8193ad64aa0c109a78cb075770c0922917e6f /gcc/substring-locations.c | |
parent | 7cdca3ec8a5ae98b5a92dcb3cb2d6d28f8f68266 (diff) | |
download | gcc-be4aa83d6ff4720fffd2c9f62c6e3082ece1937f.zip gcc-be4aa83d6ff4720fffd2c9f62c6e3082ece1937f.tar.gz gcc-be4aa83d6ff4720fffd2c9f62c6e3082ece1937f.tar.bz2 |
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.
From-SVN: r244453
Diffstat (limited to 'gcc/substring-locations.c')
-rw-r--r-- | gcc/substring-locations.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/substring-locations.c b/gcc/substring-locations.c index 8b41f2b..e2d8dd7 100644 --- a/gcc/substring-locations.c +++ b/gcc/substring-locations.c @@ -118,6 +118,8 @@ format_warning_va (const substring_loc &fmt_loc, else { if (fmt_substring_range.m_start >= fmt_loc_range.m_start + && fmt_substring_range.m_start <= fmt_loc_range.m_finish + && fmt_substring_range.m_finish >= fmt_loc_range.m_start && fmt_substring_range.m_finish <= fmt_loc_range.m_finish) /* Case 1. */ { |