~ubuntu-branches/ubuntu/feisty/cproto/feisty

« back to all changes in this revision

Viewing changes to testing/case16.ref

  • Committer: Bazaar Package Importer
  • Author(s): Carsten Leonhardt
  • Date: 2000-09-02 21:14:55 UTC
  • Revision ID: james.westby@ubuntu.com-20000902211455-ixe8p17zhnuk6jft
Tags: upstream-4.6d
ImportĀ upstreamĀ versionĀ 4.6d

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* case16.c */
 
2
void badFunc(int *badStyle);
 
3
int dots_0(int p1);
 
4
int dots_1(int p1, ...);
 
5
int dots_3(int P1, char P2, ...);
 
6
_FIRST *func1(void);
 
7
_FIRST *func2(_FIRST *P1 , int P2 [], float p);
 
8
int *(func_func)(int p1, int p2, int p3);
 
9
int main(register argc, char **argv);
 
10
int veryfunny(char *a, long b, long c);
 
11
int program(string argv[], struct alpha y, int zz, int z1, int z2, int z3);
 
12
int junk0(void);
 
13
int junk1(void);
 
14
int junk2(void);
 
15
int junk3(void);
 
16
BONG *junk4(void);
 
17
extern_junk *foo(void);
 
18
void_junk *foo2a(void);
 
19
void_junk *foo2(void);
 
20
void_junk *foo_void(void_junk void_int);
 
21
void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1);
 
22
void (*sigdisp2(int sig, void (*func)(int sig)))(int sig2);
 
23
int (*K_R_INT_ptr(long *p1, int p2))(void);
 
24
void (*K_R_VOID_ptr(long *p1, int p2))(void);
 
25
int *K_R_int_ptr(long *p1, int p2);
 
26
void *K_R_void_ptr(long *p1, int p2);
 
27
int K_R_int_val(long *p1, int p2);
 
28
int K_R_int_val2(long *p1, int p2);
 
29
void K_R_void_val(long *p1, int p2);
 
30
int K_R_void_val2(long *p1, int p2);
 
31
... edited case16.c ...
 
32
/*
 
33
 * Define:
 
34
 *      ERR_YACC        to force yacc error reporting
 
35
 *      ERR_LEX         to force lex error reporting
 
36
 *      ERR_CHECK       to force compiler error reporting
 
37
 */
 
38
                /* use one item from type-specifiers */
 
39
#ifdef  ERR_YACC
 
40
auto            x;
 
41
register        x1;
 
42
#endif  ERR_YACC
 
43
static          x2;
 
44
extern          x3;
 
45
#ifdef  ERR_CC
 
46
typedef         x4;
 
47
#endif
 
48
typedef int     x4t;
 
49
#ifdef  ERR_YACC
 
50
void            x5;
 
51
#endif  ERR_YACC
 
52
char            x6;
 
53
short           x7;
 
54
int             x8;
 
55
long            x9;
 
56
float           x10;
 
57
double          x11;
 
58
signed          x12;
 
59
unsigned        x13;
 
60
struct          x14;
 
61
#ifdef  ERR_CHECK
 
62
struct          x14a {};
 
63
struct          {};
 
64
#endif  ERR_CHECK
 
65
union           x15;
 
66
enum            x16;
 
67
x4t;
 
68
x4t             x17;
 
69
const           x18;
 
70
volatile        x19;
 
71
#ifdef  ERR_CHECK
 
72
junk            x20;
 
73
#endif  ERR_CHECK
 
74
 
 
75
typedef struct  _first  {
 
76
        int             a:5;
 
77
        struct  {
 
78
                int     a,b;
 
79
        } b_struct;
 
80
        char            b:16, b1:1;     /* comment with };};}; */
 
81
        long            c:16, c1;
 
82
        short           d:16, d1:8, d2;
 
83
        unsigned        e:16;
 
84
        float           f;
 
85
        double          g;
 
86
#ifdef  ERR_CHECK
 
87
        long    float   f2;
 
88
        long    double  g2;
 
89
#endif  ERR_CHECK
 
90
        struct  _first  *link;
 
91
        }       _FIRST;
 
92
 
 
93
typedef int badStyle; 
 
94
void badFunc(int *badStyle) { } 
 
95
 
 
96
_FIRST  first, last={0}, first_last[] = {{0},{1},{2},{3,{4}}};
 
97
 
 
98
struct  _second {
 
99
                enum    {true, false} bool;
 
100
                enum    {wrong=1, right=3} values;
 
101
        } _SECOND;
 
102
 
 
103
int     i[] = {1,
 
104
                '\002',
 
105
                03,
 
106
                0x4,
 
107
                0X5,
 
108
                0x6a,
 
109
                0X7b,
 
110
                0x8aBcD,
 
111
                9l,
 
112
                10l,
 
113
                11L};
 
114
float   f[] = {5,
 
115
#ifdef  ERR_CHECK
 
116
                .5e,
 
117
                .5e+,
 
118
                5e-,
 
119
                5e,
 
120
                .34P1,
 
121
                0x1.2.34,       /* error */
 
122
#endif
 
123
                .5,
 
124
                5.5,
 
125
                5e5,
 
126
                5e0,
 
127
                5e-1,
 
128
                5e+5
 
129
#ifdef  __STDC_VERSION__ /* ( C9X supports hexadecimal floating point ;-) */
 
130
                0x12.34+1,
 
131
                0x12.34P1,
 
132
                .34e1,
 
133
                0.34e1,
 
134
                0x.34P1,
 
135
#endif
 
136
                .0e-1
 
137
                };
 
138
 
 
139
int     array[][10][20];
 
140
 
 
141
        /*
 
142
         * This grammar can accept some illegal stuff too, in particular it will
 
143
         * permit some instances of parameter-names to be dropped.
 
144
         */
 
145
#ifdef  ERR_CHECK
 
146
#define P1
 
147
#define P2
 
148
#define P3
 
149
#else
 
150
#define P1      p1
 
151
#define P2      p2
 
152
#define P3      p3
 
153
#endif
 
154
 
 
155
        /* ellipsis is legal, except in K&R style declaration */
 
156
 
 
157
        int 
 
158
dots_0 (int p1)         { return(1); }
 
159
 
 
160
        dots_1(int p1, ...)     { return(1); }
 
161
 
 
162
#ifdef  ERR_CHECK
 
163
        dots_2(p1, ...)         { return(1); }
 
164
#endif  ERR_CHECK
 
165
 
 
166
        dots_3(int P1,char P2, ...)     { return(1); }
 
167
 
 
168
int     dots_4(int,char, char *);
 
169
char *  dots_5(int,char, char *, ...);
 
170
 
 
171
extern  _FIRST *xdots_0(p1);
 
172
 
 
173
extern  char *xdots_1(int p1, ...);
 
174
 
 
175
#ifdef  ERR_CHECK
 
176
extern  xdots_2(p1, ...);
 
177
#endif  ERR_CHECK
 
178
 
 
179
extern  xdots_3(int P1,char P2, ...);
 
180
 
 
181
_FIRST *
 
182
func1 (void) { }
 
183
_FIRST  *func2(_FIRST *P1,int P2[],float p) { }
 
184
 
 
185
int *(
 
186
func_func) (int p1, int p2, int p3)     { return(0); }
 
187
 
 
188
extern  float   efunc0(p1,p2,p3);
 
189
extern  _FIRST  efunc1(int p1, float p2,long P3);
 
190
#ifdef  ERR_CHECK
 
191
extern  _FIRST  efunc1(int p1, float p2,p3);
 
192
#endif  ERR_CHECK
 
193
 
 
194
 
 
195
typedef int     bool;
 
196
 
 
197
bool    a1;
 
198
static  bool    a2;
 
199
extern  bool    a3;
 
200
 
 
201
struct  ZIP1    { int x1, y1; };
 
202
struct  zip2    { int x2, y2; } z2;
 
203
struct          { int x3, y3; } z3;     /* not ANSI, but mostly accepted */
 
204
 
 
205
static  struct  ZIP4    { int x4, y4; };
 
206
static  struct  zip5    { int x5, y5; } z5;
 
207
static  struct  zip6    { int x6, y6; } z6, w6;
 
208
static  struct          { int x7, y7; } z7;
 
209
static  struct          { int x8, y8; } z8, w8;
 
210
 
 
211
enum    zap1    { a,b,c,d }     what;
 
212
enum    zap2                    what2;
 
213
enum            {a9,b9,c9,d9}   what3;
 
214
 
 
215
static  char    *zap = "alphabet/\
 
216
first/\
 
217
last";
 
218
typedef struct  bong    {
 
219
        int     (*func)();
 
220
        } BONG;
 
221
 
 
222
typedef char    *string;
 
223
 
 
224
#ifdef  ERR_LEX
 
225
string  s = "aaa\0000\
 
226
 
 
227
bbb";
 
228
#endif  ERR_LEX
 
229
 
 
230
extern  int     junk;
 
231
 
 
232
int 
 
233
main (register argc, extern char **argv)
 
234
{
 
235
}
 
236
 
 
237
/*VARARGS*/
 
238
/* some other comment */
 
239
int 
 
240
veryfunny (char *a, long b, long c)
 
241
{
 
242
        return 0;
 
243
}
 
244
 
 
245
/*VARARGS3*/
 
246
int 
 
247
program (
 
248
    string argv[],      /* first argument */
 
249
    struct alpha y,     /* second argument */
 
250
    int zz,
 
251
    int z1,
 
252
    int z2,
 
253
    int z3
 
254
)
 
255
{
 
256
        return(0);
 
257
}
 
258
 
 
259
int 
 
260
junk0 (void) { if(junk != 6) return; else junk++; }
 
261
int 
 
262
junk1 (void) { return (0); }
 
263
int 
 
264
junk2 (void) { }
 
265
int 
 
266
junk3 (void) { return 1; }
 
267
 
 
268
BONG *
 
269
junk4 (void) { }
 
270
 
 
271
typedef int     extern_junk;
 
272
extern_junk *
 
273
foo (void) { }
 
274
 
 
275
typedef int     void_junk;
 
276
extern void_junk *
 
277
foo2a (void) { }
 
278
extern void_junk        *foo2a();
 
279
void_junk *
 
280
foo2 (void) { }
 
281
void_junk       *foo_void(void_junk void_int) { }
 
282
static void_junk *
 
283
foo_void2 (void) { }
 
284
 
 
285
extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig);
 
286
 
 
287
void (*Sigdisp(int sig, void (*func)(int sig)))(int sig1)
 
288
{ /* nothing */ }
 
289
 
 
290
void (*
 
291
sigdisp2 (
 
292
    int sig,            /* the signal value */
 
293
    void (*func)(int sig)       /* the function pointer */
 
294
))(int sig2)
 
295
{ /* nothing again! */ }
 
296
 
 
297
int (*
 
298
K_R_INT_ptr (long *p1, int p2))(void) { return (*(int(*)())0); }
 
299
 
 
300
int (*STD_INT_ptr(long* , int))();
 
301
 
 
302
void (*
 
303
K_R_VOID_ptr (long *p1, int p2))(void) { return (*(void(*)())0); }
 
304
 
 
305
void (*STD_VOID_ptr(long* , int))();
 
306
 
 
307
int *
 
308
K_R_int_ptr (long *p1, int p2) { return (*(int **)0); }
 
309
 
 
310
int **STD_int2_ptr(long* , int);
 
311
 
 
312
int *STD_int_ptr(long* , int);
 
313
 
 
314
void *
 
315
K_R_void_ptr (long *p1, int p2) { return (*(void **)0); }
 
316
 
 
317
void *STD_void_ptr(long* , int);
 
318
 
 
319
int 
 
320
K_R_int_val (long *p1, int p2) { return (*(int *)0); }
 
321
 
 
322
int 
 
323
K_R_int_val2 (long *p1, int p2) { return (*(int *)0); }
 
324
 
 
325
int STD_int_val(long*, int);
 
326
 
 
327
void 
 
328
K_R_void_val (long *p1, int p2) { /*void*/ }
 
329
 
 
330
int 
 
331
K_R_void_val2 (
 
332
    long *p1,
 
333
    int p2 { /*void*/
 
334
) }
 
335
 
 
336
void STD_void_val(long* , int);
 
337
 
 
338
extern  xdots_3(int P1,char P2, ...);
 
339
 
 
340
extern int (*XSetAfterFunction(long* , int (*) ( long*)))();
 
341
extern XQueryKeymap(long*, char [32]);
 
342
extern Another(long*, int (*)());
 
343
 
 
344
extern GenFunc(int *, int *());
 
345
 
 
346
/* these are pointers, not actual functions */
 
347
extern void * (*__glob_opendir_hook) (const char *__directory);
 
348
extern const char *(*__glob_readdir_hook) (void * __stream);
 
349
extern void (*__glob_closedir_hook) (void * __stream);