view gcc/testsuite/gcc.dg/format/z-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* Test for bugs with %z and %Z formats.  See PRs c/89, c/156, c/376.  */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-Wformat" } */

#include "format.h"

size_t
foo (void)
{
  size_t t;
  scanf ("%zu", &t); /* { dg-bogus "length|format" "bogus scanf warning" } */
  return t;
}

void
bar (size_t t)
{
  printf ("%zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */
}

/* The %Z printf format is an old GNU libc extension to do the same thing.  */

void
baz (size_t t)
{
  printf ("%Zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */
}