1 |
12 |
jlechner |
/* Test for printf formats. C99 "long long" formats should be accepted with
|
2 |
|
|
-Wno-long-long.
|
3 |
|
|
*/
|
4 |
|
|
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
5 |
|
|
/* { dg-do compile } */
|
6 |
|
|
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-long" } */
|
7 |
|
|
|
8 |
|
|
#include "format.h"
|
9 |
|
|
|
10 |
|
|
void
|
11 |
|
|
foo (long long ll, unsigned long long ull, long long *lln,
|
12 |
|
|
long long *llp, unsigned long long *ullp)
|
13 |
|
|
{
|
14 |
|
|
/* Test for accepting standard "long long" formats. */
|
15 |
|
|
printf ("%lld%lli%llo%llu%llx%llX%lln", ll, ll, ull, ull, ull, ull, lln);
|
16 |
|
|
scanf ("%lld%lli%llo%llu%llx%llX%lln", llp, llp,
|
17 |
|
|
ullp, ullp, ullp, ullp, lln);
|
18 |
|
|
/* Use of "q" and "L" should still be warned about. */
|
19 |
|
|
printf ("%qd", ll); /* { dg-warning "C" "printf %qd" } */
|
20 |
|
|
printf ("%qi", ll); /* { dg-warning "C" "printf %qi" } */
|
21 |
|
|
printf ("%qo", ull); /* { dg-warning "C" "printf %qo" } */
|
22 |
|
|
printf ("%qu", ull); /* { dg-warning "C" "printf %qu" } */
|
23 |
|
|
printf ("%qx", ull); /* { dg-warning "C" "printf %qx" } */
|
24 |
|
|
printf ("%qX", ull); /* { dg-warning "C" "printf %qX" } */
|
25 |
|
|
printf ("%qn", lln); /* { dg-warning "C" "printf %qn" } */
|
26 |
|
|
printf ("%Ld", ll); /* { dg-warning "C" "printf %Ld" } */
|
27 |
|
|
printf ("%Li", ll); /* { dg-warning "C" "printf %Li" } */
|
28 |
|
|
printf ("%Lo", ull); /* { dg-warning "C" "printf %oL" } */
|
29 |
|
|
printf ("%Lu", ull); /* { dg-warning "C" "printf %Lu" } */
|
30 |
|
|
printf ("%Lx", ull); /* { dg-warning "C" "printf %Lx" } */
|
31 |
|
|
printf ("%LX", ull); /* { dg-warning "C" "printf %LX" } */
|
32 |
|
|
scanf ("%qd", llp); /* { dg-warning "C" "scanf %qd" } */
|
33 |
|
|
scanf ("%qi", llp); /* { dg-warning "C" "scanf %qi" } */
|
34 |
|
|
scanf ("%qo", ullp); /* { dg-warning "C" "scanf %qo" } */
|
35 |
|
|
scanf ("%qu", ullp); /* { dg-warning "C" "scanf %qu" } */
|
36 |
|
|
scanf ("%qx", ullp); /* { dg-warning "C" "scanf %qx" } */
|
37 |
|
|
scanf ("%qX", ullp); /* { dg-warning "C" "scanf %qX" } */
|
38 |
|
|
scanf ("%qn", lln); /* { dg-warning "C" "scanf %qn" } */
|
39 |
|
|
scanf ("%Ld", llp); /* { dg-warning "C" "scanf %Ld" } */
|
40 |
|
|
scanf ("%Li", llp); /* { dg-warning "C" "scanf %Li" } */
|
41 |
|
|
scanf ("%Lo", ullp); /* { dg-warning "C" "scanf %oL" } */
|
42 |
|
|
scanf ("%Lu", ullp); /* { dg-warning "C" "scanf %Lu" } */
|
43 |
|
|
scanf ("%Lx", ullp); /* { dg-warning "C" "scanf %Lx" } */
|
44 |
|
|
scanf ("%LX", ullp); /* { dg-warning "C" "scanf %LX" } */
|
45 |
|
|
}
|