(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
format/
ms_miss-1.c
       1  /* Test for warnings for missing format attributes.  */
       2  /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
       3  /* { dg-do compile { target { *-*-mingw* } } } */
       4  /* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */
       5  
       6  #define USE_SYSTEM_FORMATS
       7  #include "format.h"
       8  
       9  void
      10  foo (const char *fmt, ...)
      11  {
      12    va_list ap;
      13    va_start (ap, fmt);
      14    vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */
      15    va_end (ap);
      16  }
      17  
      18  void
      19  bar (const char *fmt, ...)
      20  {
      21    va_list ap;
      22    va_start (ap, fmt);
      23    vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" } */
      24    va_end (ap);
      25  }
      26  
      27  __attribute__((__format__(__ms_printf__, 1, 2))) void
      28  foo2 (const char *fmt, ...)
      29  {
      30    va_list ap;
      31    va_start (ap, fmt);
      32    vprintf (fmt, ap);
      33    va_end (ap);
      34  }
      35  
      36  void
      37  vfoo (const char *fmt, va_list arg)
      38  {
      39    vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */
      40  }