1 /* Test __attribute__ ((deprecated)) */
2 /* { dg-do compile } */
3 /* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */
6 typedef int INT1 __attribute__((deprecated));
7 typedef INT1 INT2 __attribute__ ((__deprecated__));
9 typedef INT1 INT1a; /* { dg-warning "'INT1' is deprecated" "" } */
10 typedef INT1 INT1b __attribute__ ((deprecated));
12 INT1 should_be_unavailable; /* { dg-warning "'INT1' is deprecated" "" } */
13 INT1a should_not_be_deprecated;
15 INT1 f1(void) __attribute__ ((deprecated));
16 INT1 f2(void) { return 0; } /* { dg-warning "'INT1' is deprecated" "" } */
18 INT2 f3(void) __attribute__ ((__deprecated__));
19 INT2 f4(void) { return 0; } /* { dg-warning "'INT2' is deprecated" "" } */
20 int f5(INT2 x); /* { dg-warning "'INT2' is deprecated" "" } */
21 int f6(INT2 x) __attribute__ ((__deprecated__));
23 typedef enum Color {red, green, blue} Color __attribute__((deprecated));
26 int g2 __attribute__ ((deprecated));
27 int g3 __attribute__ ((__deprecated__));
28 Color k; /* { dg-warning "'Color' is deprecated" "" } */
32 int field2 __attribute__ ((deprecated));
34 int field4 __attribute__ ((__deprecated__));
37 int field6 __attribute__ ((deprecated));
40 int field8:1 __attribute__ ((deprecated));
44 } u2 __attribute__ ((deprecated));
49 INT1 w; /* { dg-warning "'INT1' is deprecated" "" } */
50 int x __attribute__ ((deprecated));
51 int y __attribute__ ((__deprecated__));
53 int (*pf)() = f1; /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */
55 z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated" "" } */
56 /* { dg-warning "'y' is deprecated" "y" { target *-*-* } 55 } */
57 /* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } 55 } */
58 /* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } 55 } */
59 return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "f1" } */
67 return p->field2; /* { dg-warning "'S1::field2' is deprecated" "" } */
68 else if (lp.field4) /* { dg-warning "'S1::field4' is deprecated" "" } */
71 p->u1.field5 = g1 + p->field7;
72 p->u2.field9; /* { dg-warning "'S1::u2' is deprecated" "" } */
73 return p->u1.field6 + p->field8; /* { dg-warning "'S1::<anonymous union>::field6' is deprecated" "" } */
74 /* { dg-warning "'S1::field8' is deprecated" "field8" { target *-*-* } 73 } */
79 INT1 y; /* { dg-warning "'INT1' is deprecated" "" } */
80 } __attribute__ ((deprecated));
82 struct SS1 *p1; /* { dg-warning "'SS1' is deprecated" "" } */
84 struct __attribute__ ((__deprecated__)) SS2 {
86 INT1 y; /* { dg-warning "'INT1' is deprecated" "" } */
89 struct SS2 *p2; /* { dg-warning "'SS2' is deprecated" "" } */
95 void member1(int) __attribute__ ((deprecated));
96 void member2(INT1) __attribute__ ((__deprecated__)); /* { dg-warning "'INT1' is deprecated" "" } */
99 } __attribute__ ((deprecated));
101 T *p3; // { dg-warning "'T' is deprecated" }
103 inline void T::member1(int) {}
105 int T::member3(T *p) // { dg-warning "'T' is deprecated" }
107 p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
108 (*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
109 p->member2(1); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */
110 (*p).member2(2); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */
113 return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */