Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / format / c99-scanf-2.c
blobeedf3e57c103510a12f97bddfd2e8839b5a9ae25
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 } */
6 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
8 #include "format.h"
10 void
11 foo (int *ip, long long int *llp, wchar_t *ls)
13 /* The length modifiers q and L as applied to integer formats are
14 extensions.
16 scanf ("%qd", llp); /* { dg-warning "C" "%q length" } */
17 scanf ("%Ld", llp); /* { dg-warning "C" "%L length" } */
18 /* The conversion specifiers C and S are X/Open extensions. */
19 scanf ("%C", ls); /* { dg-warning "C" "scanf %C" } */
20 scanf ("%S", ls); /* { dg-warning "C" "scanf %S" } */
21 /* The use of operand number $ formats is an X/Open extension. */
22 scanf ("%1$d", ip); /* { dg-warning "C" "scanf $ format" } */
23 /* glibc also supports flags ' and I on scanf formats as an extension. */
24 scanf ("%'d", ip); /* { dg-warning "C" "scanf ' flag" } */
25 scanf ("%Id", ip); /* { dg-warning "C" "scanf I flag" } */