c-format: -Wformat-diag fix [PR93641]
authorJakub Jelinek <jakub@redhat.com>
Mon, 10 Feb 2020 14:50:17 +0000 (15:50 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 10 Feb 2020 14:50:17 +0000 (15:50 +0100)
commita59aa3026821ac4883198f1858984b6f78612ae6
tree43b27a683d641376e51fcc4983df9c4faa96cfbf
parent5602b48b2ed84feb1a5792e3d73b00b42138ca6e
c-format: -Wformat-diag fix [PR93641]

The last argument to strncasecmp is incorrect, so it matched even when
can%' wasn't followed by t.  Also, the !ISALPHA (format_chars[1]) test
looks pointless, format_chars[1] must be ' if strncasecmp succeeded and
so will never be ISALPHA.

2020-02-10  Jakub Jelinek  <jakub@redhat.com>

PR other/93641
* c-format.c (check_plain): Fix up last argument of strncasecmp.
Remove useless extra test.

* gcc.dg/format/gcc_diag-11.c (test_cdiag_bad_words): Add two further
tests.
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/gcc_diag-11.c