Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/format/ms_multattr-2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Test for multiple format attributes. Test for printf and scanf attributes | |
2 together, in different places on the declarations. */ | |
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */ | |
4 /* { dg-do compile { target { *-*-mingw* } } } */ | |
5 /* { dg-options "-std=gnu99 -Wformat" } */ | |
6 | |
7 #define USE_SYSTEM_FORMATS | |
8 #include "format.h" | |
9 | |
10 /* If we specify multiple attributes for a single function, they should | |
11 all apply, wherever they are placed on the declarations. */ | |
12 | |
13 extern __attribute__((__format__(__ms_printf__, 1, 0))) void | |
14 my_vprintf_scanf (const char *, va_list, const char *, ...) | |
15 __attribute__((__format__(__ms_scanf__, 3, 4))); | |
16 | |
17 extern void (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf2) | |
18 (const char *, va_list, const char *, ...) | |
19 __attribute__((__format__(__ms_scanf__, 3, 4))); | |
20 | |
21 extern __attribute__((__format__(__ms_scanf__, 3, 4))) void | |
22 (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf3) | |
23 (const char *, va_list, const char *, ...); | |
24 | |
25 void | |
26 foo (va_list ap, int *ip, long *lp) | |
27 { | |
28 my_vprintf_scanf ("%d", ap, "%d", ip); | |
29 my_vprintf_scanf ("%d", ap, "%ld", lp); | |
30 my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ | |
31 my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ | |
32 my_vprintf_scanf2 ("%d", ap, "%d", ip); | |
33 my_vprintf_scanf2 ("%d", ap, "%ld", lp); | |
34 my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ | |
35 my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ | |
36 my_vprintf_scanf3 ("%d", ap, "%d", ip); | |
37 my_vprintf_scanf3 ("%d", ap, "%ld", lp); | |
38 my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ | |
39 my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ | |
40 } |