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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cast-qual-3.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-Wcast-qual" } */
3
 
4
/* The files gcc.dg/cast-qual-3.c and g++.dg/warn/Wcast-qual2.c are
5
   duals.  they are intended to show that gcc -Wcast-qual and g++
6
   -Wcast-qual emit warnings in the same cases.  If you change this
7
   file, please also change the other one.  */
8
 
9
void
10
f1 (void *bar)
11
{
12
  const void *p1 = (const void *) bar;
13
  const char *p2 = (const char *) bar;
14
  const void **p3 = (const void **) bar;
15
  const char **p4 = (const char **) bar;
16
  const void * const *p5 = (const void * const *) bar;
17
  const char * const *p6 = (const char * const *) bar;
18
  void * const *p7 = (void * const *) bar;
19
  char * const *p8 = (char * const *) bar;
20
  const void ***p9 = (const void ***) bar;
21
  const char ***p10 = (const char ***) bar;
22
  void * const **p11 = (void * const **) bar;
23
  char * const **p12 = (char * const **) bar;
24
  void ** const *p13 = (void ** const *) bar;
25
  char ** const *p14 = (char ** const *) bar;
26
  const void * const **p15 = (const void * const **) bar;
27
  const char * const **p16 = (const char * const **) bar;
28
  const void ** const *p17 = (const void ** const *) bar;
29
  const char ** const *p18 = (const char ** const *) bar;
30
  void * const * const * p19 = (void * const * const *) bar;
31
  char * const * const * p20 = (char * const * const *) bar;
32
  const void * const * const *p21 = (const void * const * const *) bar;
33
  const char * const * const *p22 = (const char * const * const *) bar;
34
}
35
 
36
void
37
f2 (void **bar)
38
{
39
  const void *p1 = (const void *) bar;
40
  const char *p2 = (const char *) bar;
41
  const void **p3 = (const void **) bar; /* { dg-warning "cast" } */
42
  const char **p4 = (const char **) bar;
43
  const void * const *p5 = (const void * const *) bar;
44
  const char * const *p6 = (const char * const *) bar;
45
  void * const *p7 = (void * const *) bar;
46
  char * const *p8 = (char * const *) bar;
47
  const void ***p9 = (const void ***) bar;
48
  const char ***p10 = (const char ***) bar;
49
  void * const **p11 = (void * const **) bar;
50
  char * const **p12 = (char * const **) bar;
51
  void ** const *p13 = (void ** const *) bar;
52
  char ** const *p14 = (char ** const *) bar;
53
  const void * const **p15 = (const void * const **) bar;
54
  const char * const **p16 = (const char * const **) bar;
55
  const void ** const *p17 = (const void ** const *) bar;
56
  const char ** const *p18 = (const char ** const *) bar;
57
  void * const * const * p19 = (void * const * const *) bar;
58
  char * const * const * p20 = (char * const * const *) bar;
59
  const void * const * const *p21 = (const void * const * const *) bar;
60
  const char * const * const *p22 = (const char * const * const *) bar;
61
}
62
 
63
void
64
f3 (void ***bar)
65
{
66
  const void *p1 = (const void *) bar;
67
  const char *p2 = (const char *) bar;
68
  const void **p3 = (const void **) bar;
69
  const char **p4 = (const char **) bar;
70
  const void * const *p5 = (const void * const *) bar;
71
  const char * const *p6 = (const char * const *) bar;
72
  void * const *p7 = (void * const *) bar;
73
  char * const *p8 = (char * const *) bar;
74
  const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
75
  const char ***p10 = (const char ***) bar;
76
  void * const **p11 = (void * const **) bar; /* { dg-warning "cast" } */
77
  char * const **p12 = (char * const **) bar;
78
  void ** const *p13 = (void ** const *) bar;
79
  char ** const *p14 = (char ** const *) bar;
80
  const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
81
  const char * const **p16 = (const char * const **) bar;
82
  const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
83
  const char ** const *p18 = (const char ** const *) bar;
84
  void * const * const * p19 = (void * const * const *) bar;
85
  char * const * const * p20 = (char * const * const *) bar;
86
  const void * const * const *p21 = (const void * const * const *) bar;
87
  const char * const * const *p22 = (const char * const * const *) bar;
88
}
89
 
90
void
91
f4 (void * const **bar)
92
{
93
  const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
94
  void * const **p11 = (void * const **) bar;
95
  void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
96
  const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
97
  const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
98
  void * const * const * p19 = (void * const * const *) bar;
99
  const void * const * const *p21 = (const void * const * const *) bar;
100
}
101
 
102
void
103
f5 (char ***bar)
104
{
105
  volatile const char ***p9 = (volatile const char ***) bar; /* { dg-warning "cast" } */
106
  volatile char * const **p11 = (volatile char * const **) bar; /* { dg-warning "cast" } */
107
  volatile char ** const *p13 = (volatile char ** const *) bar; /* { dg-warning "cast" } */
108
  volatile const char * const **p15 = (volatile const char * const **) bar; /* { dg-warning "cast" } */
109
  volatile const char ** const *p17 = (volatile const char ** const *) bar; /* { dg-warning "cast" } */
110
  volatile char * const * const * p19 = (volatile char * const * const *) bar;
111
  volatile const char * const * const *p21 = (volatile const char * const * const *) bar;
112
}
113
 
114
void
115
f6 (char ***bar)
116
{
117
  const char * volatile **p9 = (const char * volatile **) bar; /* { dg-warning "cast" } */
118
  char * volatile const **p11 = (char * volatile const **) bar; /* { dg-warning "cast" } */
119
  char * volatile * const *p13 = (char * volatile * const *) bar;
120
  const char * volatile const **p15 = (const char * volatile const **) bar; /* { dg-warning "cast" } */
121
  const char * volatile * const *p17 = (const char * volatile * const *) bar; /* { dg-warning "cast" } */
122
  char * volatile const * const * p19 = (char * volatile const * const *) bar;
123
  const char * volatile const * const *p21 = (const char * volatile const * const *) bar;
124
}
125
 
126
void
127
f7 (char ***bar)
128
{
129
  const char ** volatile *p9 = (const char ** volatile *) bar; /* { dg-warning "cast" } */
130
  char * const * volatile *p11 = (char * const * volatile *) bar; /* { dg-warning "cast" } */
131
  char ** volatile const *p13 = (char ** volatile const *) bar;
132
  const char * const * volatile *p15 = (const char * const * volatile *) bar; /* { dg-warning "cast" } */
133
  const char ** volatile const *p17 = (const char ** volatile const *) bar; /* { dg-warning "cast" } */
134
  char * const * volatile const * p19 = (char * const * volatile const *) bar;
135
  const char * const * volatile const *p21 = (const char * const * volatile const *) bar;
136
}
137
 
138
typedef int (intfn) (int);
139
typedef intfn *pintfn;
140
typedef const intfn *constfn;
141
 
142
void
143
f8 (constfn ***bar)
144
{
145
  const constfn *p1 = (const constfn *) bar;
146
  const pintfn *p2 = (const pintfn *) bar;
147
  const constfn **p3 = (const constfn **) bar;
148
  const pintfn **p4 = (const pintfn **) bar;
149
  const constfn * const *p5 = (const constfn * const *) bar;
150
  const pintfn * const *p6 = (const pintfn * const *) bar;
151
  constfn * const *p7 = (constfn * const *) bar;
152
  pintfn * const *p8 = (pintfn * const *) bar;
153
  const constfn ***p9 = (const constfn ***) bar; /* { dg-warning "cast" } */
154
  const pintfn ***p10 = (const pintfn ***) bar; /* { dg-warning "cast" } */
155
  constfn * const **p11 = (constfn * const **) bar; /* { dg-warning "cast" } */
156
  pintfn * const **p12 = (pintfn * const **) bar; /* { dg-warning "cast" } */
157
  constfn ** const *p13 = (constfn ** const *) bar;
158
  pintfn ** const *p14 = (pintfn ** const *) bar;
159
  const constfn * const **p15 = (const constfn * const **) bar; /* { dg-warning "cast" } */
160
  const pintfn * const **p16 = (const pintfn * const **) bar; /* { dg-warning "cast" } */
161
  const constfn ** const *p17 = (const constfn ** const *) bar; /* { dg-warning "cast" } */
162
  const pintfn ** const *p18 = (const pintfn ** const *) bar; /* { dg-warning "cast" } */
163
  constfn * const * const * p19 = (constfn * const * const *) bar;
164
  pintfn * const * const * p20 = (pintfn * const * const *) bar;
165
  const constfn * const * const *p21 = (const constfn * const * const *) bar;
166
  const pintfn * const * const *p22 = (const pintfn * const * const *) bar;
167
}

powered by: WebSVN 2.1.0

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