1 /* Test __attribute__ ((deprecated)) */
2 /* { dg-do compile } */
3 /* { dg-options "-Wdeprecated-declarations" } */
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__
)); /* { dg-warning "'INT2' is deprecated" } */
23 typedef enum {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 "'f1' is deprecated" } */
55 z
= w
+ x
+ y
+ g1
+ g2
+ g3
; /* { dg-warning "'x' is deprecated" } */
56 /* { dg-warning "'y' is deprecated" "y" { target *-*-* } .-1 } */
57 /* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } .-2 } */
58 /* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } .-3 } */
59 return f1(); /* { dg-warning "'f1' is deprecated" "f1" } */
67 return p
->field2
; /* { dg-warning "'field2' is deprecated" } */
68 else if (lp
.field4
) /* { dg-warning "'field4' is deprecated" } */
71 p
->u1
.field5
= g1
+ p
->field7
;
72 p
->u2
.field9
; /* { dg-warning "'u2' is deprecated" } */
73 return p
->u1
.field6
+ p
->field8
; /* { dg-warning "'field6' is deprecated" } */
74 /* { dg-warning "'field8' is deprecated" "field8" { target *-*-* } .-1 } */
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__
));
99 } __attribute__ ((deprecated
));
103 inline void T::member1(int) {}
107 p
->member1(1); /* { xxdg-warning "'member1' is deprecated" } */
108 (*p
).member1(2); /* { xxdg-warning "'member1' is deprecated" } */
109 p
->member2(1); /* { xxdg-warning "'member2' is deprecated" } */
110 (*p
).member2(2); /* { xxdg-warning "'member2' is deprecated" } */
113 return f1(); /* { xxdg-warning "'f1' is deprecated" } */