Add a test suite for etags
[emacs.git] / test / etags / c-src / dostorture.c
blob5190734e0fe6e77cf854a2c54be9cba348484281
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
6 Hi,
8 This test file illustrates some more problems with etags (7.3):
11 1. parentheses are confusing,
12 2. preprocessor directives can disrupt other state machines. */
14 /* A small torture test for etags. */
16 /* The classic parenthesis nightmare, based on signal(). */
17 void
18 (*tag1 (sig, handler)) ()
19 int sig;
20 void (*handler) ();
22 (*handler)(sig);
23 return handler;
26 #define notag2 void
27 /* The classic, with user-defined return type. */
28 notag2
29 (*tag2 (sig, handler)) ()
30 int sig;
31 void (*handler) ();
33 (*handler)(sig);
34 return handler;
37 /* The classic, in ANSI C style. */
38 void
39 (*tag3 (int sig, void (*handler) (int))) (int)
41 (*handler)(sig);
42 return handler;
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)
50 (*handler)(sig);
51 return handler;
55 /* A less tortuous example. */
56 void
57 tag5 (handler, arg)
58 void (*handler)();
59 void *arg;
61 (*handler)(arg);
64 /* A less tortuous example, in ANSI C style. */
65 void
66 tag6 (void (*handler) (void *), void *arg)
68 (*handler)(arg);
72 /* Interfering preprocessing torture */
74 int pp1(
75 #if (__STDC__)
76 int
77 #endif
78 bar)
79 #if (!__STDC__)
80 int bar;
81 #endif
83 return bar;
86 int
87 pp2
88 #if __STDC__
89 (int bar)
90 #else
91 (bar)
92 int bar;
93 #endif
95 return bar;
98 int
99 #if __STDC__
100 pp3(int bar)
101 #else
102 pp3(bar)
103 int bar;
104 #endif
106 return bar;