PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / format / cmn-err-1.c
blobaea7779a2c3b4e4dd6d16214b96ba459174ba31c
1 /* { dg-do compile { target *-*-solaris2.* } } */
2 /* { dg-options "-Wformat" } */
4 #include "format.h"
6 void cmn_err_func (int level, char * format, ...)
7 __attribute__((format (cmn_err, 2, 3)));
9 void cmn_err_func (int level, char * format, ...)
13 const char *string = "foo";
15 int main()
17 int i = 1;
18 long l = 2;
19 llong ll = 3;
21 cmn_err_func (0, "%s", string);
22 cmn_err_func (0, "%d %D %o %O %x %X %u", i, i, i, i, i, i, i);
23 cmn_err_func (0, "%ld %lD %lo %lO %lx %lX %lu", l, l, l, l, l, l, l);
24 cmn_err_func (0, "%lld %llD %llo %llO %llx %llX %llu",
25 ll, ll, ll, ll, ll, ll, ll);
26 cmn_err_func (0, "%b %s", i, "\01Foo", string);
27 cmn_err_func (0, "%p", string);
28 cmn_err_func (0, "%16b", i, "\01Foo");
30 cmn_err_func (0, "%i", i); /* { dg-warning "unknown|too many" } */
31 cmn_err_func (0, "%d", l); /* { dg-warning "expects argument" } */
32 cmn_err_func (0, "%b"); /* { dg-warning "'int'" } */
33 /* { dg-warning "'char \\*'" "" { target *-*-solaris2.* } .-1 } */
34 cmn_err_func (0, "%b", i); /* { dg-warning "matching" } */
35 cmn_err_func (0, "%b", i, i); /* { dg-warning "expects argument" } */
36 cmn_err_func (0, "%b", string, i); /* { dg-warning "expects argument" } */
37 cmn_err_func (0, "%p", 3); /* { dg-warning "expects argument" } */
38 return 0;