view gcc/testsuite/gcc.dg/format/diag-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 format diagnostics.  */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wformat" } */

#include "format.h"

void
foo (double d)
{
  /* This should get a message referring to `hh', not to `H'.  */
  printf ("%hhf", d); /* { dg-warning "hh" "%hhf warning" } */
  /* This should get a message referring to `ll', not to `q'.  */
  printf ("%llf", d); /* { dg-warning "ll" "%llf warning" } */
  /* This should get a message referring to 'size_t', not to
     'unsigned int' or similar.  */
  printf ("%zu", d); /* { dg-warning "size_t" "size_t format warning" } */
}