1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| | /* Date: Thu, 05 Aug 1993 20:28:03 +0200
From: "Tom R.Hageman" <tom@basil.icce.rug.nl>
Subject: more etags torture;-) [etags 7.3 patch#3]
To: pot@CNUCE.CNR.IT
Hi,
This test file illustrates some more problems with etags (7.3):
1. parentheses are confusing,
2. preprocessor directives can disrupt other state machines. */
/* A small torture test for etags. */
/* The classic parenthesis nightmare, based on signal(). */
void
(*tag1 (sig, handler)) ()
int sig;
void (*handler) ();
{
(*handler)(sig);
return handler;
}
#define notag2 void
/* The classic, with user-defined return type. */
notag2
(*tag2 (sig, handler)) ()
int sig;
void (*handler) ();
{
(*handler)(sig);
return handler;
}
/* The classic, in ANSI C style. */
void
(*tag3 (int sig, void (*handler) (int))) (int)
{
(*handler)(sig);
return handler;
}
#define notag4 void
/* The classic, with user-defined return type, in ANSI C style. */
notag4
(*tag4 (int sig, void (*handler) (int))) (int)
{
(*handler)(sig);
return handler;
}
/* A less tortuous example. */
void
tag5 (handler, arg)
void (*handler)();
void *arg;
{
(*handler)(arg);
}
/* A less tortuous example, in ANSI C style. */
void
tag6 (void (*handler) (void *), void *arg)
{
(*handler)(arg);
}
/* Interfering preprocessing torture */
int pp1(
#if (__STDC__)
int
#endif
bar)
#if (!__STDC__)
int bar;
#endif
{
return bar;
}
int
pp2
#if __STDC__
(int bar)
#else
(bar)
int bar;
#endif
{
return bar;
}
int
#if __STDC__
pp3(int bar)
#else
pp3(bar)
int bar;
#endif
{
return bar;
}
|