testsuite: Add %[zt][diox] tests to gcc.dg/format/
commitd04eeb472a86c1b7ed129900e9166b4d4e6aea88
authorJakub Jelinek <jakub@redhat.com>
Wed, 14 Feb 2024 13:36:44 +0000 (14 14:36 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 14 Feb 2024 13:36:44 +0000 (14 14:36 +0100)
treeb0c408c45aee867c1649730fac9d411f67c1c44c
parente8971ef99505161d09c9bf0174b38fa15fc6e59f
testsuite: Add %[zt][diox] tests to gcc.dg/format/

On Mon, Feb 12, 2024 at 04:10:33PM +0000, Joseph Myers wrote:
> Please also add some tests of format checking for these modifiers in
> gcc.dg/format/gcc_*.c.

The following patch does that.

Haven't added tests for bad type (but I think we don't have them in
c99-printf* either) for these because it is hard to figure out what
type from {,unsigned }{int,long,long long} size_t/ptrdiff_t certainly
is not, guess one could do that with preprocessor conditionals, e.g.
comparing __PTRDIFF_MAX__ with __INT_MAX__, __LONG_MAX__ and
__LONG_LONG_MAX__ and pick up the one which is different; but we'd need
to find out corresponding effective targets for the expected diagnostics.

2024-02-14  Jakub Jelinek  <jakub@redhat.com>

* gcc.dg/format/gcc_diag-1.c (foo): Add tests for z and t modifiers.
* gcc.dg/format/gcc_gfc-1.c (foo): Add tests for ll, z and t modifiers.
gcc/testsuite/gcc.dg/format/gcc_diag-1.c
gcc/testsuite/gcc.dg/format/gcc_gfc-1.c