1 /* Test for scanf formats for Decimal Floating Point types. */
3 /* { dg-do compile } */
4 /* { dg-require-effective-target dfp } */
5 /* { dg-options "-Wformat" } */
6 /* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } } */
11 voo (_Decimal32
*x
, _Decimal64
*y
, _Decimal128
*z
, int *i
, unsigned int *j
,
14 /* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from
16 /* Formatted input/output specifiers. */
18 /* Check lack of warnings for valid usage. */
41 scanf ("%DG%DDE%HF%DDe%He%HE%DF%DDF%De%DDG%HG%Df%Hg%DE%DDf%Dg%DDg%Hf\n",
42 y
, z
, x
, z
, x
, x
, y
, z
, y
, z
, x
, y
, x
, y
, z
, y
, z
, x
);
44 /* Check warnings for type mismatches. */
46 scanf ("%Hf", y
); /* { dg-warning "expects argument" "bad use of %H" } */
47 scanf ("%HF", y
); /* { dg-warning "expects argument" "bad use of %H" } */
48 scanf ("%He", y
); /* { dg-warning "expects argument" "bad use of %H" } */
49 scanf ("%HE", y
); /* { dg-warning "expects argument" "bad use of %H" } */
50 scanf ("%Hg", y
); /* { dg-warning "expects argument" "bad use of %H" } */
51 scanf ("%HG", y
); /* { dg-warning "expects argument" "bad use of %H" } */
52 scanf ("%Hf", z
); /* { dg-warning "expects argument" "bad use of %H" } */
53 scanf ("%HF", z
); /* { dg-warning "expects argument" "bad use of %H" } */
54 scanf ("%He", z
); /* { dg-warning "expects argument" "bad use of %H" } */
55 scanf ("%HE", z
); /* { dg-warning "expects argument" "bad use of %H" } */
56 scanf ("%Hg", z
); /* { dg-warning "expects argument" "bad use of %H" } */
57 scanf ("%HG", z
); /* { dg-warning "expects argument" "bad use of %H" } */
59 scanf ("%Df", x
); /* { dg-warning "expects argument" "bad use of %D" } */
60 scanf ("%DF", x
); /* { dg-warning "expects argument" "bad use of %D" } */
61 scanf ("%De", x
); /* { dg-warning "expects argument" "bad use of %D" } */
62 scanf ("%DE", x
); /* { dg-warning "expects argument" "bad use of %D" } */
63 scanf ("%Dg", x
); /* { dg-warning "expects argument" "bad use of %D" } */
64 scanf ("%DG", x
); /* { dg-warning "expects argument" "bad use of %D" } */
65 scanf ("%Df", z
); /* { dg-warning "expects argument" "bad use of %D" } */
66 scanf ("%DF", z
); /* { dg-warning "expects argument" "bad use of %D" } */
67 scanf ("%De", z
); /* { dg-warning "expects argument" "bad use of %D" } */
68 scanf ("%DE", z
); /* { dg-warning "expects argument" "bad use of %D" } */
69 scanf ("%Dg", z
); /* { dg-warning "expects argument" "bad use of %D" } */
70 scanf ("%DG", z
); /* { dg-warning "expects argument" "bad use of %D" } */
72 scanf ("%DDf", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
73 scanf ("%DDF", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
74 scanf ("%DDe", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
75 scanf ("%DDE", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
76 scanf ("%DDg", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
77 scanf ("%DDG", x
); /* { dg-warning "expects argument" "bad use of %DD" } */
78 scanf ("%DDf", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
79 scanf ("%DDF", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
80 scanf ("%DDe", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
81 scanf ("%DDE", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
82 scanf ("%DDg", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
83 scanf ("%DDG", y
); /* { dg-warning "expects argument" "bad use of %DD" } */
85 /* Check for warnings for bad use of H, D, and DD length specifiers. */
87 scanf ("%Hd\n", i
); /* { dg-warning "length" "bad use of %H" } */
88 scanf ("%Hi\n", i
); /* { dg-warning "length" "bad use of %H" } */
89 scanf ("%Ho\n", j
); /* { dg-warning "length" "bad use of %H" } */
90 scanf ("%Hu\n", j
); /* { dg-warning "length" "bad use of %H" } */
91 scanf ("%Hx\n", j
); /* { dg-warning "length" "bad use of %H" } */
92 scanf ("%HX\n", j
); /* { dg-warning "length" "bad use of %H" } */
93 scanf ("%Ha\n", d
); /* { dg-warning "length" "bad use of %H" } */
94 scanf ("%HA\n", d
); /* { dg-warning "length" "bad use of %H" } */
95 scanf ("%Hc\n", i
); /* { dg-warning "length" "bad use of %H" } */
96 scanf ("%Hs\n", p
); /* { dg-warning "length" "bad use of %H" } */
97 scanf ("%Hp\n", p
); /* { dg-warning "length" "bad use of %H" } */
98 scanf ("%Hn\n", p
); /* { dg-warning "length" "bad use of %H" } */