1 |
149 |
jeremybenn |
/* Test for scanf formats for Decimal Floating Point types. */
|
2 |
|
|
|
3 |
|
|
/* { dg-do compile } */
|
4 |
|
|
/* { dg-require-effective-target dfp } */
|
5 |
|
|
/* { dg-options "-Wformat" } */
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
#include "format.h"
|
9 |
|
|
|
10 |
|
|
void
|
11 |
|
|
voo (_Decimal32 *x, _Decimal64 *y, _Decimal128 *z, int *i, unsigned int *j,
|
12 |
|
|
double *d, char **p)
|
13 |
|
|
{
|
14 |
|
|
/* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from
|
15 |
|
|
2005-03-06). */
|
16 |
|
|
/* Formatted input/output specifiers. */
|
17 |
|
|
|
18 |
|
|
/* Check lack of warnings for valid usage. */
|
19 |
|
|
|
20 |
|
|
scanf ("%Hf", x);
|
21 |
|
|
scanf ("%HF", x);
|
22 |
|
|
scanf ("%He", x);
|
23 |
|
|
scanf ("%HE", x);
|
24 |
|
|
scanf ("%Hg", x);
|
25 |
|
|
scanf ("%HG", x);
|
26 |
|
|
|
27 |
|
|
scanf ("%Df", y);
|
28 |
|
|
scanf ("%DF", y);
|
29 |
|
|
scanf ("%De", y);
|
30 |
|
|
scanf ("%DE", y);
|
31 |
|
|
scanf ("%Dg", y);
|
32 |
|
|
scanf ("%DG", y);
|
33 |
|
|
|
34 |
|
|
scanf ("%DDf", z);
|
35 |
|
|
scanf ("%DDF", z);
|
36 |
|
|
scanf ("%DDe", z);
|
37 |
|
|
scanf ("%DDE", z);
|
38 |
|
|
scanf ("%DDg", z);
|
39 |
|
|
scanf ("%DDG", z);
|
40 |
|
|
|
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);
|
43 |
|
|
|
44 |
|
|
/* Check warnings for type mismatches. */
|
45 |
|
|
|
46 |
|
|
scanf ("%Hf", y); /* { dg-warning "expects type" "bad use of %H" } */
|
47 |
|
|
scanf ("%HF", y); /* { dg-warning "expects type" "bad use of %H" } */
|
48 |
|
|
scanf ("%He", y); /* { dg-warning "expects type" "bad use of %H" } */
|
49 |
|
|
scanf ("%HE", y); /* { dg-warning "expects type" "bad use of %H" } */
|
50 |
|
|
scanf ("%Hg", y); /* { dg-warning "expects type" "bad use of %H" } */
|
51 |
|
|
scanf ("%HG", y); /* { dg-warning "expects type" "bad use of %H" } */
|
52 |
|
|
scanf ("%Hf", z); /* { dg-warning "expects type" "bad use of %H" } */
|
53 |
|
|
scanf ("%HF", z); /* { dg-warning "expects type" "bad use of %H" } */
|
54 |
|
|
scanf ("%He", z); /* { dg-warning "expects type" "bad use of %H" } */
|
55 |
|
|
scanf ("%HE", z); /* { dg-warning "expects type" "bad use of %H" } */
|
56 |
|
|
scanf ("%Hg", z); /* { dg-warning "expects type" "bad use of %H" } */
|
57 |
|
|
scanf ("%HG", z); /* { dg-warning "expects type" "bad use of %H" } */
|
58 |
|
|
|
59 |
|
|
scanf ("%Df", x); /* { dg-warning "expects type" "bad use of %D" } */
|
60 |
|
|
scanf ("%DF", x); /* { dg-warning "expects type" "bad use of %D" } */
|
61 |
|
|
scanf ("%De", x); /* { dg-warning "expects type" "bad use of %D" } */
|
62 |
|
|
scanf ("%DE", x); /* { dg-warning "expects type" "bad use of %D" } */
|
63 |
|
|
scanf ("%Dg", x); /* { dg-warning "expects type" "bad use of %D" } */
|
64 |
|
|
scanf ("%DG", x); /* { dg-warning "expects type" "bad use of %D" } */
|
65 |
|
|
scanf ("%Df", z); /* { dg-warning "expects type" "bad use of %D" } */
|
66 |
|
|
scanf ("%DF", z); /* { dg-warning "expects type" "bad use of %D" } */
|
67 |
|
|
scanf ("%De", z); /* { dg-warning "expects type" "bad use of %D" } */
|
68 |
|
|
scanf ("%DE", z); /* { dg-warning "expects type" "bad use of %D" } */
|
69 |
|
|
scanf ("%Dg", z); /* { dg-warning "expects type" "bad use of %D" } */
|
70 |
|
|
scanf ("%DG", z); /* { dg-warning "expects type" "bad use of %D" } */
|
71 |
|
|
|
72 |
|
|
scanf ("%DDf", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
73 |
|
|
scanf ("%DDF", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
74 |
|
|
scanf ("%DDe", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
75 |
|
|
scanf ("%DDE", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
76 |
|
|
scanf ("%DDg", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
77 |
|
|
scanf ("%DDG", x); /* { dg-warning "expects type" "bad use of %DD" } */
|
78 |
|
|
scanf ("%DDf", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
79 |
|
|
scanf ("%DDF", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
80 |
|
|
scanf ("%DDe", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
81 |
|
|
scanf ("%DDE", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
82 |
|
|
scanf ("%DDg", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
83 |
|
|
scanf ("%DDG", y); /* { dg-warning "expects type" "bad use of %DD" } */
|
84 |
|
|
|
85 |
|
|
/* Check for warnings for bad use of H, D, and DD length specifiers. */
|
86 |
|
|
|
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" } */
|
99 |
|
|
}
|