Debian Codegraph @

gcc/testsuite/gcc.dg/noncompile/20020213-1.c

raw
1 /* { dg-additional-options "-fpermissive" } */
2 /* PR c/5503
3 Test whether argument checking is done for fputs, bzero and bcmp. */
4 typedef struct { int i; } FILE;
5 typedef __SIZE_TYPE__ size_t;
6
7 int fputs (const char *, FILE *);
8 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
9
10 void bzero (void *, size_t);
11 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
12
13 int bcmp (const void *, const void *, size_t);
14 /* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
15
16 char buf[32];
17 FILE *f;
18
19 int main ()
20 {
21 fputs ("foo"); /* { dg-error "too few" } */
22
23 fputs ("foo", "bar", "baz"); /* { dg-error "too many" } */
24 /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } .-1 } */
25
26 fputs (21, 43);
27 /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
28 /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } .-2 } */
29
30 bzero (buf); /* { dg-error "too few" } */
31
32 bzero (21); /* { dg-error "too few" } */
33 /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
34
35 bcmp (buf, buf + 16); /* { dg-error "too few" } */
36
37 bcmp (21); /* { dg-error "too few" } */
38 /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
39
40 fputs ("foo", f);
41 bzero (buf, 32);
42 bcmp (buf, buf + 16, 16);
43 return 0;
44 }