annotate gcc/testsuite/gcc.dg/format/ms_c99-printf-3.c @ 131:84e7813d76e9

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