comparison gcc/testsuite/gcc.dg/format/ms_c99-printf-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Test for printf formats. Test that the C99 functions get their default
2 attributes in strict C99 mode, but the gettext functions do not.
3 */
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile { target { *-*-mingw* } } } */
6 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
7
8 #define USE_SYSTEM_FORMATS
9 #include "format.h"
10
11 void
12 foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
13 va_list v4, va_list v5, va_list v6, va_list v7)
14 {
15 fprintf (stdout, "%d", i);
16 fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
17 printf ("%d", i);
18 printf ("%ld", i); /* { dg-warning "format" "printf" } */
19 /* The "unlocked" functions shouldn't warn in c99 mode. */
20 fprintf_unlocked (stdout, "%ld", i);
21 printf_unlocked ("%ld", i);
22 sprintf (s, "%d", i);
23 sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
24 snprintf (s, n, "%d", i);
25 snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */
26 vfprintf (stdout, "%d", v0);
27 vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
28 vprintf ("%d", v0);
29 vprintf ("%Y", v1); /* { dg-warning "format" "vprintf" } */
30 vsprintf (s, "%d", v0);
31 vsprintf (s, "%Y", v1); /* { dg-warning "format" "vsprintf" } */
32 vsnprintf (s, n, "%d", v0);
33 vsnprintf (s, n, "%Y", v1); /* { dg-warning "format" "vsnprintf" } */
34 printf (gettext ("%d"), i);
35 printf (gettext ("%ld"), (long) i);
36 printf (dgettext ("", "%d"), i);
37 printf (dgettext ("", "%ld"), (long) i);
38 printf (dcgettext ("", "%d", 0), i);
39 printf (dcgettext ("", "%ld", 0), (long) i);
40 }