Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/format/ms_c99-scanf-2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 (2017-10-27) |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Test for scanf formats. Formats using extensions to the standard | |
2 should be rejected in strict pedantic mode. | |
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 *ip, long long int *llp, wchar_t *ls) | |
13 { | |
14 /* The length modifiers q and L as applied to integer formats are | |
15 extensions. | |
16 */ | |
17 scanf ("%qd", llp); /* { dg-warning "unknown|format" "%q is unsupported" } */ | |
18 scanf ("%Ld", llp); /* { dg-warning "unknown|format" "%L is unsupported" } */ | |
19 /* The conversion specifiers C and S are X/Open extensions. */ | |
20 scanf ("%C", ls); /* { dg-warning "C" "scanf %C" } */ | |
21 scanf ("%S", ls); /* { dg-warning "C" "scanf %S" } */ | |
22 /* The use of operand number $ formats is an X/Open extension. */ | |
23 scanf ("%1$d", ip); /* { dg-warning "C" "scanf $ format" } */ | |
24 /* glibc also supports flags ' and I on scanf formats as an extension. */ | |
25 scanf ("%'d", ip); /* { dg-warning "C" "scanf ' flag" } */ | |
26 scanf ("%Id", (ssize_t *)ip); /* { dg-warning "C" "scanf I flag" } */ | |
27 } |