annotate gcc/testsuite/gcc.dg/cleanup-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-Wall" } */
kono
parents:
diff changeset
3 /* Validate expected warnings and errors. */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #define U __attribute__((unused))
kono
parents:
diff changeset
6 #define C(x) __attribute__((cleanup(x)))
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 static int f1(void *x U) { return 0; }
kono
parents:
diff changeset
9 static void f2() { }
kono
parents:
diff changeset
10 static void f3(void) { } /* { dg-message "note: declared here" } */
kono
parents:
diff changeset
11 static void f4(void *x U) { }
kono
parents:
diff changeset
12 static void f5(int *x U) { }
kono
parents:
diff changeset
13 static void f6(double *x U) { } /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */
kono
parents:
diff changeset
14 static void f7(const int *x U) { }
kono
parents:
diff changeset
15 static void f8(const int *x U, int y U) { } /* { dg-message "note: declared here" } */
kono
parents:
diff changeset
16 static void f9(int x U) { } /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 void test(void)
kono
parents:
diff changeset
19 {
kono
parents:
diff changeset
20 int o1 C(f1);
kono
parents:
diff changeset
21 int o2 C(f2);
kono
parents:
diff changeset
22 int o3 C(f3); /* { dg-error "too many arguments" } */
kono
parents:
diff changeset
23 int o4 C(f4);
kono
parents:
diff changeset
24 int o5 C(f5);
kono
parents:
diff changeset
25 int o6 C(f6); /* { dg-warning "incompatible pointer type" } */
kono
parents:
diff changeset
26 int o7 C(f7);
kono
parents:
diff changeset
27 int o8 C(f8); /* { dg-error "too few arguments" } */
kono
parents:
diff changeset
28 int o9 C(f9); /* { dg-warning "from pointer without a cast" } */
kono
parents:
diff changeset
29 int o10 U C(undef); /* { dg-error "not a function" } */
kono
parents:
diff changeset
30 int o11 U C(o1); /* { dg-error "not a function" } */
kono
parents:
diff changeset
31 int o12 U C("f1"); /* { dg-error "not an identifier" } */
kono
parents:
diff changeset
32 static int o13 U C(f1); /* { dg-warning "attribute ignored" } */
kono
parents:
diff changeset
33 }
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 int o14 C(f1); /* { dg-warning "attribute ignored" } */
kono
parents:
diff changeset
36 void t15(int o U C(f1)) {} /* { dg-warning "attribute ignored" } */