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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [deprecated-4.c] - Blame information for rev 300

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test __attribute__ ((deprecated("message"))) */
2
/* { dg-do compile } */
3
/* { dg-options "-Wdeprecated-declarations" } */
4
 
5
typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
6
typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
7
 
8
typedef INT1 INT1a;                     /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
9
typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));
10
 
11
INT1 should_be_unavailable;             /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
12
INT1a should_not_be_deprecated;
13
 
14
INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
15
INT1 f2(void) { return 0; }              /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
16
 
17
INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3")));
18
INT2 f4(void) { return 0; }              /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
19
int f5(INT2 x);                         /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
20
int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6"))); /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
21
 
22
typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));
23
 
24
int g1;
25
int g2 __attribute__ ((deprecated("Please avoid g2")));
26
int g3 __attribute__ ((__deprecated__("Please avoid g3")));
27
Color k;                                /* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */
28
 
29
typedef struct {
30
  int field1;
31
  int field2 __attribute__ ((deprecated("Please avoid field2")));
32
  int field3;
33
  int field4 __attribute__ ((__deprecated__("Please avoid field4")));
34
  union {
35
    int field5;
36
    int field6 __attribute__ ((deprecated("Please avoid field6")));
37
  } u1;
38
  int field7:1;
39
  int field8:1 __attribute__ ((deprecated("Please avoid field8")));
40
  union {
41
    int field9;
42
    int field10;
43
  } u2 __attribute__ ((deprecated("Please avoid u2")));
44
} S1;
45
 
46
int func1()
47
{
48
   INT1 w;                              /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
49
   int x __attribute__ ((deprecated("Avoid x")));
50
   int y __attribute__ ((__deprecated__("Bad y")));
51
   int z;
52
   int (*pf)() = f1;                    /* { dg-warning "'f1' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
53
 
54
   z = w + x + y + g1 + g2 + g3;        /* { dg-warning "'x' is deprecated .declared at \[^\n\]*: Avoid x" "" } */
55
                                        /* { dg-warning "'y' is deprecated .declared at \[^\n\]*: Bad y" "y" { target *-*-* } 54  } */
56
                                        /* { dg-warning "'g2' is deprecated .declared at \[^\n\]*: Please avoid g2" "g2" { target *-*-* } 54  }  */
57
                                        /* { dg-warning "'g3' is deprecated .declared at \[^\n\]*: Please avoid g3" "g3" { target *-*-* } 54  } */
58
   return f1();                         /* { dg-warning "'f1' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
59
}
60
 
61
int func2(S1 *p)
62
{
63
  S1 lp;
64
 
65
  if (p->field1)
66
     return p->field2;                  /* { dg-warning "'field2' is deprecated .declared at \[^\n\]*: Please avoid field2" "" } */
67
  else if (lp.field4)                   /* { dg-warning "'field4' is deprecated .declared at \[^\n\]*: Please avoid field4" "" } */
68
     return p->field3;
69
 
70
  p->u1.field5 = g1 + p->field7;
71
  p->u2.field9;                         /* { dg-warning "'u2' is deprecated .declared at \[^\n\]*: Please avoid u2" "" } */
72
  return p->u1.field6 + p->field8;      /* { dg-warning "'field6' is deprecated .declared at \[^\n\]*: Please avoid field6" "" } */
73
                                        /* { dg-warning "'field8' is deprecated .declared at \[^\n\]*: Please avoid field8" "field8" { target *-*-* } 72 } */
74
}
75
 
76
struct SS1 {
77
  int x;
78
  INT1 y;                               /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
79
} __attribute__ ((deprecated("Please avoid SS1")));
80
 
81
struct SS1 *p1;                         /* { dg-warning "'SS1' is deprecated .declared at \[^\n\]*: Please avoid SS1" "" } */
82
 
83
struct __attribute__ ((__deprecated__("Please avoid SS2"))) SS2 {
84
  int x;
85
  INT1 y;                               /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
86
};
87
 
88
struct SS2 *p2;                         /* { dg-warning "'SS2' is deprecated .declared at \[^\n\]*: Please avoid SS2" "" } */

powered by: WebSVN 2.1.0

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