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