1 |
689 |
jeremybenn |
/* Test for format attributes: test use of __attribute__. */
|
2 |
|
|
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
3 |
|
|
/* { dg-do compile { target { *-*-mingw* } } } */
|
4 |
|
|
/* { dg-options "-std=gnu99 -Wformat" } */
|
5 |
|
|
|
6 |
|
|
#define DONT_GNU_PROTOTYPE
|
7 |
|
|
#include "format.h"
|
8 |
|
|
|
9 |
|
|
extern void tformatprintf (const char *, ...) __attribute__((format(ms_printf, 1, 2)));
|
10 |
|
|
extern void tformat__printf__ (const char *, ...) __attribute__((format(__ms_printf__, 1, 2)));
|
11 |
|
|
extern void tformatscanf (const char *, ...) __attribute__((format(ms_scanf, 1, 2)));
|
12 |
|
|
extern void tformat__scanf__ (const char *, ...) __attribute__((format(__ms_scanf__, 1, 2)));
|
13 |
|
|
extern void tformatstrftime (const char *) __attribute__((format(ms_strftime, 1, 0)));
|
14 |
|
|
extern void tformat__strftime__ (const char *) __attribute__((format(__ms_strftime__, 1, 0)));
|
15 |
|
|
extern void tformatstrfmon (const char *, ...) __attribute__((format(strfmon, 1, 2)));
|
16 |
|
|
extern void tformat__strfmon__ (const char *, ...) __attribute__((format(__strfmon__, 1, 2)));
|
17 |
|
|
extern void t__format__printf (const char *, ...) __attribute__((__format__(ms_printf, 1, 2)));
|
18 |
|
|
extern void t__format____printf__ (const char *, ...) __attribute__((__format__(__ms_printf__, 1, 2)));
|
19 |
|
|
extern void t__format__scanf (const char *, ...) __attribute__((__format__(ms_scanf, 1, 2)));
|
20 |
|
|
extern void t__format____scanf__ (const char *, ...) __attribute__((__format__(__ms_scanf__, 1, 2)));
|
21 |
|
|
extern void t__format__strftime (const char *) __attribute__((__format__(ms_strftime, 1, 0)));
|
22 |
|
|
extern void t__format____strftime__ (const char *) __attribute__((__format__(__ms_strftime__, 1, 0)));
|
23 |
|
|
extern void t__format__strfmon (const char *, ...) __attribute__((__format__(strfmon, 1, 2)));
|
24 |
|
|
extern void t__format____strfmon__ (const char *, ...) __attribute__((__format__(__strfmon__, 1, 2)));
|
25 |
|
|
|
26 |
|
|
extern char *tformat_arg (const char *) __attribute__((format_arg(1)));
|
27 |
|
|
extern char *t__format_arg__ (const char *) __attribute__((__format_arg__(1)));
|
28 |
|
|
|
29 |
|
|
void
|
30 |
|
|
foo (int i, int *ip, double d)
|
31 |
|
|
{
|
32 |
|
|
tformatprintf ("%d", i);
|
33 |
|
|
tformatprintf ("%"); /* { dg-warning "format" "attribute format printf" } */
|
34 |
|
|
tformat__printf__ ("%d", i);
|
35 |
|
|
tformat__printf__ ("%"); /* { dg-warning "format" "attribute format __printf__" } */
|
36 |
|
|
tformatscanf ("%d", ip);
|
37 |
|
|
tformatscanf ("%"); /* { dg-warning "format" "attribute format scanf" } */
|
38 |
|
|
tformat__scanf__ ("%d", ip);
|
39 |
|
|
tformat__scanf__ ("%"); /* { dg-warning "format" "attribute format __scanf__" } */
|
40 |
|
|
tformatstrftime ("%a");
|
41 |
|
|
tformatstrftime ("%"); /* { dg-warning "format" "attribute format strftime" } */
|
42 |
|
|
tformat__strftime__ ("%a");
|
43 |
|
|
tformat__strftime__ ("%"); /* { dg-warning "format" "attribute format __strftime__" } */
|
44 |
|
|
tformatstrfmon ("%n", d);
|
45 |
|
|
tformatstrfmon ("%"); /* { dg-warning "format" "attribute format strfmon" } */
|
46 |
|
|
tformat__strfmon__ ("%n", d);
|
47 |
|
|
tformat__strfmon__ ("%"); /* { dg-warning "format" "attribute format __strfmon__" } */
|
48 |
|
|
t__format__printf ("%d", i);
|
49 |
|
|
t__format__printf ("%"); /* { dg-warning "format" "attribute __format__ printf" } */
|
50 |
|
|
t__format____printf__ ("%d", i);
|
51 |
|
|
t__format____printf__ ("%"); /* { dg-warning "format" "attribute __format__ __printf__" } */
|
52 |
|
|
t__format__scanf ("%d", ip);
|
53 |
|
|
t__format__scanf ("%"); /* { dg-warning "format" "attribute __format__ scanf" } */
|
54 |
|
|
t__format____scanf__ ("%d", ip);
|
55 |
|
|
t__format____scanf__ ("%"); /* { dg-warning "format" "attribute __format__ __scanf__" } */
|
56 |
|
|
t__format__strftime ("%a");
|
57 |
|
|
t__format__strftime ("%"); /* { dg-warning "format" "attribute __format__ strftime" } */
|
58 |
|
|
t__format____strftime__ ("%a");
|
59 |
|
|
t__format____strftime__ ("%"); /* { dg-warning "format" "attribute __format__ __strftime__" } */
|
60 |
|
|
t__format__strfmon ("%n", d);
|
61 |
|
|
t__format__strfmon ("%"); /* { dg-warning "format" "attribute __format__ strfmon" } */
|
62 |
|
|
t__format____strfmon__ ("%n", d);
|
63 |
|
|
t__format____strfmon__ ("%"); /* { dg-warning "format" "attribute __format__ __strfmon__" } */
|
64 |
|
|
tformatprintf (tformat_arg ("%d"), i);
|
65 |
|
|
tformatprintf (tformat_arg ("%")); /* { dg-warning "format" "attribute format_arg" } */
|
66 |
|
|
tformatprintf (t__format_arg__ ("%d"), i);
|
67 |
|
|
tformatprintf (t__format_arg__ ("%")); /* { dg-warning "format" "attribute __format_arg__" } */
|
68 |
|
|
}
|