OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [deprecated.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test __attribute__ ((deprecated)) */
2
/* { dg-do compile } */
3
/* { dg-options "-Wdeprecated-declarations" } */
4
 
5
#if 1
6
typedef int INT1 __attribute__((deprecated));
7
typedef INT1 INT2 __attribute__ ((__deprecated__));
8
 
9
typedef INT1 INT1a;                     /* { dg-warning "'INT1' is deprecated" "" } */
10
typedef INT1 INT1b __attribute__ ((deprecated));
11
 
12
INT1 should_be_unavailable;             /* { dg-warning "'INT1' is deprecated" "" } */
13
INT1a should_not_be_deprecated;
14
 
15
INT1 f1(void) __attribute__ ((deprecated));
16
INT1 f2(void) { return 0; }              /* { dg-warning "'INT1' is deprecated" "" } */
17
 
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" "" } */
22
 
23
typedef enum {red, green, blue} Color __attribute__((deprecated));
24
 
25
int g1;
26
int g2 __attribute__ ((deprecated));
27
int g3 __attribute__ ((__deprecated__));
28
Color k;                                /* { dg-warning "'Color' is deprecated" "" } */
29
 
30
typedef struct {
31
  int field1;
32
  int field2 __attribute__ ((deprecated));
33
  int field3;
34
  int field4 __attribute__ ((__deprecated__));
35
  union {
36
    int field5;
37
    int field6 __attribute__ ((deprecated));
38
  } u1;
39
  int field7:1;
40
  int field8:1 __attribute__ ((deprecated));
41
  union {
42
    int field9;
43
    int field10;
44
  } u2 __attribute__ ((deprecated));
45
} S1;
46
 
47
int func1()
48
{
49
   INT1 w;                              /* { dg-warning "'INT1' is deprecated" "" } */
50
   int x __attribute__ ((deprecated));
51
   int y __attribute__ ((__deprecated__));
52
   int z;
53
   int (*pf)() = f1;                    /* { dg-warning "'f1' is deprecated" "" } */
54
 
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 "'f1' is deprecated" "f1" } */
60
}
61
 
62
int func2(S1 *p)
63
{
64
  S1 lp;
65
 
66
  if (p->field1)
67
     return p->field2;                  /* { dg-warning "'field2' is deprecated" "" } */
68
  else if (lp.field4)                   /* { dg-warning "'field4' is deprecated" "" } */
69
     return p->field3;
70
 
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 *-*-* } 73 } */
75
}
76
 
77
struct SS1 {
78
  int x;
79
  INT1 y;                               /* { dg-warning "'INT1' is deprecated" "" } */
80
} __attribute__ ((deprecated));
81
 
82
struct SS1 *p1;                         /* { dg-warning "'SS1' is deprecated" "" } */
83
 
84
struct __attribute__ ((__deprecated__)) SS2 {
85
  int x;
86
  INT1 y;                               /* { dg-warning "'INT1' is deprecated" "" } */
87
};
88
 
89
struct SS2 *p2;                         /* { dg-warning "'SS2' is deprecated" "" } */
90
#endif
91
 
92
#ifdef __cplusplus
93
class T {
94
  public:
95
    void member1(int) __attribute__ ((deprecated));
96
    void member2(INT1) __attribute__ ((__deprecated__));
97
    int member3(T *);
98
    int x;
99
} __attribute__ ((deprecated));
100
 
101
T *p2;
102
 
103
inline void T::member1(int) {}
104
 
105
int T::member2(T *p)
106
{
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" "" } */
111
  p->member3(p);
112
  (*p).member3(p);
113
  return f1();                          /* { xxdg-warning "'f1' is deprecated" "" } */
114
}
115
#endif
116
 
117
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.