annotate test/cedet/tests/test.cpp @ 105336:bd4a08d4865a

Fix comment typo.
author Glenn Morris <rgm@gnu.org>
date Thu, 01 Oct 2009 04:31:40 +0000
parents c99cf31de3f2
children 7f4c7f5c0eba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105267
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 /* Test file for C++ language.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2 * Attempt to include as many aspects of the C++ language as possible.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 * Do not include things tested in test.c since that shares the
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 * same language.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 *
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 * $Id: test.cpp,v 1.1.2.1 2009/09/20 04:00:17 cyd Exp $
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 *
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 /* An include test */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 #include <stdio.h>
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 #include <cmath>
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 #include "c++-test.hh"
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 #include <c++-test.hh>
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 double var1 = 1.2;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 int simple1(int a) {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 struct foo1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 int test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 struct foo2 : public foo1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 const int foo21(int a, int b);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 const int foo22(int a, int b) { return 1 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 /* Classes */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 class class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 int var11;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 struct foo1 var12;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 int p_var11;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 struct foo p_var12;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 class i_class1 : public class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 int var11;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 struct foo var12;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 int p_var11;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 struct foo p_var12;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 class class2 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 int var21;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 struct foo var22;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 int p_var21;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 struct foo p_var22;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 class i_class2 : public class1, public class2 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 int var21;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 struct foo var22;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 protected:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 int pt_var21;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 int p_var21;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 struct foo p_var22;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 class class3 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 /* A class with strange things in it */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 class3(); /* A constructor */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 enum embedded_foo_enum {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 a, b, c
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 } embed1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 struct embedded_bar_struct {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 int a;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 int b;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 } embed2;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 class embedded_baz_class {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 embedded_baz_class();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ~embedded_baz_class();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 } embed3;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ~class3(); /* destructor */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 /* Methods */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 int method_for_class3(int a, char b);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 int inline_method(int c) { return c; }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 /* Operators */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 class3& operator^= (const class3& something);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 /* Funny declmods */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 const class3 * const method_const_ptr_ptr(const int * const argconst) const = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 class3::class3()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 /* Constructor outside the definition. */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 int class3::method_for_class3(int a, char b)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 int class3::method1_for_class3( int a, int &b)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 int cvariablename;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 class3 fooy[];
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 class3 moose = new class3;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 // Complktion testing line should find external members.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 a = fooy[1].me ;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 b = cv ;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 if (fooy.emb) {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 simple1(c);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 cos(10);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 abs(10);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 return 1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 char class3::method2_for_class3( int a, int b) throw ( exception1 )
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 return 'a';
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 void *class3::method3_for_class3( int a, int b) throw ( exception1, exception2 )
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 int q = a;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 return "Moose";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 void *class3::method31_for_class3( int a, int b) throw ( )
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 int q = a;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 return "Moose";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 void *class3::method4_for_class3( int a, int b) reentrant
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 class3 ct;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ct.method5_for_class3(1,a);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 pritf();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 /*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 * A method on class3.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 void *class3::method5_for_class3( int a, int b) const
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 /*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 * Namespace parsing tests
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 namespace NS {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 class class_in_namespace {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 int equiv(const NS::class_in_namespace *) const;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 int NS::class_in_namespace::equiv(const NS::class_in_namespace *cin) const
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 return 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 // Stuff Klaus found.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 // Inheritance w/out a specifying for public.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 class class4 : class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 // Pure virtual methods.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 void virtual print () const = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 // The whacky constructor type
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 class4()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 try : class1(args)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 // constructor body
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 catch ()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 class class5 : public virtual class4 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 // Virtual inheritance
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 class class6 : class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 // Mutable
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 mutable int i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 /* Namespaces */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 namespace namespace1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 void ns_method1() { }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 class n_class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 void method11(int a) { }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 /* This shouldn't parse due to missing semicolon. */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 class _n_class2 : public n_class1 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 void n_c2_method1(int a, int b) { }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 // Macros in the namespace
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 #define NSMACRO 1
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 // Template in the namespace
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 template<class T> T nsti1(const Foo& foo);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 template<> int nsti1<int>(const Foo& foo);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 namespace namespace2 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 using namespace1::n_class1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 /* Initializers */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 void tinitializers1(): inita1(False),
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 inita2(False)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 inita1= 1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 /* How about Extern C type things. */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 int funny_prototype(int ,int b,float c)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 extern "C"
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 int extern_c_1(int a, int b)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 funny_prototype(1,2,3.4);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 printf("Moose", );
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 return 1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 extern "C" {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 int extern_c_2(int a, int b)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 return 1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 // Some operator stuff
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 class Action
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 // Problems!! operator() and operator[] can not be parsed with semantic
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 // 1.4.2 but with latest c.by
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 virtual void operator()(int i, char *p ) = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 virtual String& operator[]() = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 virtual void operator!() = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 virtual void operator->() = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 virtual T& operator+=();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 virtual T& operator*();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 virtual T& operator*=();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 // class with namespace qualified parents
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 class Multiinherit : public virtual POA::Parent,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 public virtual POA::Parent1,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 Parent
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 int i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 Multiinherit();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 ~Multiinherit();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 // method with a list of qualified exceptions
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 void* throwtest()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 throw(Exception0,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 Testnamespace::Exception1,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 Testnamespace::Excpetion2,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 Testnamespace::testnamespace1::Exception3);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 void*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 Multiinherit::throwtest()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 throw (Exception0,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 Testnamespace::Exception1,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 Testnamespace::Excpetion2,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 Testnamespace::testnamespace1::Exception3)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 // Jens Rock <jens.rock@asamnet.de>: Nested classes or structs defined
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 // outside of the containing class/struct.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 class container
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 struct contained;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 container();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 ~container();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 struct container::contained
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 contained();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 ~contained();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 /*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 * Ok, how about some template stuff.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 */
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 template <class CT, class container = vector<CT> >
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 const CT& max (const CT& a, const CT& b)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 return a < b ? b : a;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 // Arne Schmitz found this one
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 std::vector<int> &a, &b, &c;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 class TemplateUsingClass
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 typedef TestClassMap::iterator iterator;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 typedef map<long, long> TestClassMap;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 // typedefs with const and volatile
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 typedef const map<long, long> const_TestClassMap;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 typedef TestClassMap<string>::iterator volatile volatile_iterator;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 map<int, int> mapclassvarthingy;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 template<class T> T ti1(const Foo& foo);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 template<> int ti1<int>(const Foo& foo);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 // -----------------------------------
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 // Now some namespace and related stuff
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 // -----------------------------------
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 using CORBA::LEX::get_token;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 using Namespace1;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 using namespace POA::std;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 using namespace Test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 namespace Parser
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 namespace
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 using Lexer::get_test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 string str = "";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 namespace XXX
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 class Foobar : public virtual POA::Parent,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 public virtual POA::Parent1,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 private POA::list<fact>,
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 private map<string>
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 ini i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 list <shared_ptr<item> >::const_iterator l;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 Foobar();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 ~Foobar();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 void test_function(int i);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 // unnamed namespaces - even nested
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 namespace
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 namespace
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 using Lexer::get_test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 string str = "";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 // some builtin types
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 long long ll = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 long double d = 0.0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 unsigned test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 unsigned long int **uli = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 signed si = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 signed short ss = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 short int i = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 long int li = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 // expressions with namespace/class-qualifyiers
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 ORB_var cGlobalOrb = ORB::_nil();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 ORB_var1 cGlobalOrb1 = ORB::_test;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 class Testclass
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 #define TEST 0
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 ini i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 Testclass();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 ~Testclass();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 static void test_function(unsigned int i);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 // outside method implementations which should be grouped to type Test
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 XXX&
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 Test::waiting()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 void
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 Test::print()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 // outside method implementations with namespaces which should be grouped to
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 // their complete (incl. namespace) types
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 void*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 Parser::XXX::Foobar::wait(int i, const char const * const * p)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 void*
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 Namespace1::Test::wait1(int i)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 int
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 Namespace1::Test::waiting(int i)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 // a class with some outside implementations which should all be grouped to
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 // this class declaration
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 class ClassWithExternals
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 private:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 int i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 public:
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 ClassWithExternals();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 ~ClassWithExternals();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 void non_nil();
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 };
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 // Foobar is not displayed; seems that semantic tries to add this to the class
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 // Foobar but can not find/display it, because contained in the namespace above.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 void
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 Foobar::non_nil()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 // are correctly grouped to the ClassWithExternals class
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 void
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 ClassWithExternals::non_nil()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 String s = "lödfjg dlfgkdlfkgjdl";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 ClassWithExternals::ClassWithExternals()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 void
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 ClassWithExternals::~ClassWithExternals()
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 {
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 return;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 // -------------------------------
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 // Now some macro and define stuff
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 // -------------------------------
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 #define TEST 0
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 #define TEST1 "String"
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 // The first backslash makes this macro unmatched syntax with semantic 1.4.2!
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 // With flexing \+newline as nothing all is working fine!
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 #define MZK_ENTER(METHOD) \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 { \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 CzkMethodLog lMethodLog(METHOD,"Framework");\
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 #define ZK_ASSERTM(METHOD,ASSERTION,MESSAGE) \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 { if(!(ASSERTION))\
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 {\
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 std::ostringstream lMesgStream; \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 lMesgStream << "Assertion failed: " \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 << MESSAGE; \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 CzkLogManager::doLog(CzkLogManager::FATAL,"",METHOD, \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 "Assert",lMesgStream); \
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 assert(ASSERTION);\
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 }\
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 }
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 // Test if not newline-backslashes are handled correctly
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 string s = "My \"quoted\" string";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 // parsed fine as macro
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 #define FOO (arg) method(arg, "foo");
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 // With semantic 1.4.2 this parsed as macro BAR *and* function method.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 // With latest c.bnf at least one-liner macros can be parsed correctly.
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 #define BAR (arg) CzkMessageLog method(arg, "bar");
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 // some const and volatile stuff
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 char * p1 = "Hello"; // 1. variable Pointer, variable Data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 const char * p2 = "Hello"; // 2. variable pointer, constant data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 char * const p3 = "Hello"; // 3. constant pointer, variable data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 const char * const p4 = "Hello"; // 4. constant pointer, constant data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 // Case 2 and 4 can exchange first "const" and "char"
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 char const * p21 = "Hello"; // variable pointer, constant data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 char const * const p41 = "Hello"; // constant pointer, constant data
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 char volatile a = 0; // a volatile char
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 void foo(bar const &arg); // a reference to a const bar
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 int foobar(bar const * const p); // a const pointer to a const bar
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 int foobar(bar const volatile * const p); // a const pointer to a const bar
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 int foobar3(char* p); // a const pointer to a const bar
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 // Should not be parsed because this is invalid code
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 int const & const r3 = i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 boolean i = 0;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 boolean & r1 = i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 boolean const & r2 = i;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 // const * sequences can be very long in C++ ;-)
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 char const * const * const * const * ppp;
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 // complex function declarationen with named pointer-arguments
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 const char** foobar1(volatile char const * const **p);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 const char** foobar11(volatile Test::Namespace::Char<char*> const * const **p);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 // complex function declarationen with unnamed pointer-arguments
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 const char* foobar2(const char***);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 const char* foobar21(const Test::Namespace::Char<char>***);
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 // string literal parsing even with wchar_t
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 char const *p = "string1";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 char const *q = "string1" "str\"ing2" "string3";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 wchar_t testc = L'a';
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 wchar_t const *wp = L"string with a \" in it";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 wchar_t const *wq = L"string \n\t\"test" L"string2";
c99cf31de3f2 Add CEDET tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 wchar_t const *wr = L"string L";