PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/name_warnings.i

#
Swig | 73 lines | 48 code | 14 blank | 11 comment | 0 complexity | 281d69c2471dd8eb19eb5e09cb8eb310 MD5 | raw file
 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
21class string; // csharp keyword
22namespace 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#ifndef SWIGGO // func is a keyword in Go.
44    virtual int func() = 0;
45#endif
46  private:
47     typedef complex False;
48  };
49
50  template <class T>
51    T max (T a, T b) { // python 'max' built-in
52    return a > b ? a : b;
53  }  
54
55  struct B : A
56  {
57    B() {}
58  };
59  
60  
61}
62
63%template(max_i) max<int>;
64
65%inline {
66  /* silently rename the parameter names in csharp/java */
67#ifdef SWIGR
68  double foo(double inparam, double out) { return 1.0; }
69#else
70  double foo(double abstract, double out) { return 1.0; }
71#endif
72  double bar(double native, bool boolean) { return 1.0; }
73}