import source from 1.3.40
[external/swig.git] / Examples / test-suite / name_warnings.i
1 %module name_warnings
2 /*
3   This test should produce no warnings at all.
4
5   It just show the cases where swig was showing unintended warnings
6   before.
7
8   Right now the test includes some cases for python, java and csharp.
9
10 */
11
12 /* activate all the name warnings */
13 %warnfilter(+SWIGWARN_PARSE_KEYWORD,+SWIGWARN_PARSE_BUILTIN_NAME,-SWIGWARN_TYPE_ABSTRACT);
14
15 %{
16 #ifdef max
17 #undef max
18 #endif
19 %}
20
21 class string; // csharp keyword
22 namespace std 
23 {
24   template <class T>
25     class complex;
26 }
27
28 %inline 
29 {
30   class complex; // python built-in
31
32   typedef complex None;  // python built-in
33   
34   struct A 
35   {
36     typedef complex None;
37     
38 #ifndef SWIGPHP // clone() *is* an invalid method name in PHP.
39     A* clone(int) { return NULL; }
40 #endif
41     
42     virtual ~A() {}
43     virtual int func() = 0;
44   private:
45      typedef complex False;
46   };
47
48   template <class T>
49     T max (T a, T b) { // python 'max' built-in
50     return a > b ? a : b;
51   }  
52
53   struct B : A
54   {
55     B() {}
56   };
57   
58   
59 }
60
61 %template(max_i) max<int>;
62
63 %inline {
64   /* silently rename the parameter names in csharp/java */
65 #ifdef SWIGR
66   double foo(double inparam, double out) { return 1.0; }
67 #else
68   double foo(double abstract, double out) { return 1.0; }
69 #endif
70   double bar(double native, bool boolean) { return 1.0; }
71 }