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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [wtr-func-def-1.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for -Wtraditional warnings on ISO C function definitions.
2
   Note, gcc should omit these warnings in system header files.
3
   Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 6/30/2002.  */
4
/* { dg-do compile } */
5
/* { dg-options "-Wtraditional" } */
6
 
7
/* Test some simple cases.  */
8
 
9
void f_void1 (void)
10
{ /* { dg-warning "traditional C rejects ISO C style" } */
11
  return;
12
}
13
 
14
void f_void2 ()
15
{
16
  return;
17
}
18
 
19
void f_int1 (int f)
20
{ /* { dg-warning "traditional C rejects ISO C style" } */
21
  return;
22
}
23
 
24
void f_int2 (f)
25
     int f;
26
{
27
  return;
28
}
29
 
30
/* Test that we don't ever warn about nested functions.  */
31
 
32
void f_int3 (int f)
33
{ /* { dg-warning "traditional C rejects ISO C style" } */
34
  void f3a (void) { return; }
35
  void f3b () { return; }
36
  void f3c (int f) { return; }
37
  void f3d (f) int f; { return; }
38
  void f3e (const char *f, ...) { return; }
39
  return;
40
}
41
 
42
void f_int4 (int f)
43
{ /* { dg-warning "traditional C rejects ISO C style" } */
44
  void f4a (void) { return; }
45
  void f4b () { return; }
46
  void f4c (int f) { return; }
47
  void f4d (f) int f; { return; }
48
  void f4e (const char *f, ...) { return; }
49
  auto f4f (void) { return 0; }
50
  return;
51
}
52
 
53
void f_int5 (f)
54
     int f;
55
{
56
  void f5a (void) { return; }
57
  void f5b () { return; }
58
  void f5c (int f) { return; }
59
  void f5d (f) int f; { return; }
60
  void f5e (const char *f, ...) { return; }
61
  return;
62
}
63
 
64
void f_int6 (f)
65
     int f;
66
{
67
  void f6a (void) { return; }
68
  void f6b () { return; }
69
  void f6c (int f) { return; }
70
  void f6d (f) int f; { return; }
71
  void f6e (const char *f, ...) { return; }
72
  auto f6f (void) { return 0; }
73
  return;
74
}
75
 
76
/* Test that prototypes are silently accepted and function definitions
77
   are still warned about.  */
78
 
79
extern void f_int_p1 (int);
80
void f_int_p1 (int f)
81
{ /* { dg-warning "traditional C rejects ISO C style" } */
82
  return;
83
}
84
 
85
extern void f_int_p2 (int f);
86
void f_int_p2 (int f)
87
{ /* { dg-warning "traditional C rejects ISO C style" } */
88
  return;
89
}
90
 
91
extern void f_int_p3 (int);
92
void f_int_p3 (f)
93
     int f;
94
{
95
  return;
96
}
97
 
98
extern void f_int_p4 (int f);
99
void f_int_p4 (f)
100
     int f;
101
{
102
  return;
103
}
104
 
105
extern void f_void_p1 ();
106
void f_void_p1 (void)
107
{ /* { dg-warning "traditional C rejects ISO C style" } */
108
  return;
109
}
110
 
111
extern void f_void_p2 (void);
112
void f_void_p2 (void)
113
{ /* { dg-warning "traditional C rejects ISO C style" } */
114
  return;
115
}
116
 
117
extern void f_blank_p1 ();
118
void f_blank_p1 ()
119
{
120
  return;
121
}
122
 
123
extern void f_blank_p2 (void);
124
void f_blank_p2 ()
125
{
126
  return;
127
}
128
 
129
/* Test some implicit int functions.  */
130
 
131
f_impl1()
132
{
133
  return 0;
134
}
135
 
136
f_impl2(void)
137
{ /* { dg-warning "traditional C rejects ISO C style" } */
138
  return 0;
139
}
140
 
141
f_impl3(int f)
142
{ /* { dg-warning "traditional C rejects ISO C style" } */
143
  return 0;
144
}
145
 
146
/* Test stdarg functions.  */
147
 
148
f_stdarg1(const char *s, ...)
149
{ /* { dg-warning "traditional C rejects ISO C style" } */
150
  return 0;
151
}
152
 
153
void f_stdarg2(const char *s, ...)
154
{ /* { dg-warning "traditional C rejects ISO C style" } */
155
  return;
156
}
157
 
158
extern void f_stdarg3(const char *, ...);
159
void f_stdarg3(const char *s, ...)
160
{ /* { dg-warning "traditional C rejects ISO C style" } */
161
  return;
162
}
163
 
164
/* Test handling function pointer parameters.  */
165
 
166
void f_fnptr1 (int f, int (*fp)(int));
167
void f_fnptr1 (int f, int (*fp)(int))
168
{ /* { dg-warning "traditional C rejects ISO C style" } */
169
  return;
170
}
171
 
172
void f_fnptr2 (int f, int (*fp)(int));
173
void f_fnptr2 (f, fp)
174
     int f;
175
     int (*fp)(int);
176
{
177
  return;
178
}
179
 
180
/* Test for main.  */
181
 
182
int
183
main (int argc, char **argv)
184
{ /* { dg-warning "traditional C rejects ISO C style" } */
185
  return 0;
186
}
187
 
188
# 182 "sys-header.h" 3
189
/* We are in system headers now, no -Wtraditional warnings should issue.  */
190
 
191
void fsys1 (void)
192
{
193
  return;
194
}
195
 
196
void fsys2 (int f)
197
{
198
  return;
199
}
200
 
201
void fsys3 (const char *f, ...)
202
{
203
  return;
204
}

powered by: WebSVN 2.1.0

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