PageRenderTime 12ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/redefined.i

#
Swig | 107 lines | 76 code | 30 blank | 1 comment | 0 complexity | 4371c66da2dfedf8d755f645cc0e390a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1%module redefined
  2
  3%warnfilter(801) agua;
  4
  5/* no redundant warnings */
  6%warnfilter(322);
  7
  8#if 1
  9 //
 10 // All these repeated declarations are not redefinitions,
 11 // and they are valid C++ code, therefore, we skip 
 12 // swig redefined warnings.
 13 //
 14%define uja
 15  aju;
 16%enddef
 17
 18%define uja
 19  aju;
 20%enddef
 21
 22%constant int agua = 0;
 23%constant int agua = 0;
 24
 25%inline %{
 26
 27#define REDUNDANT 1
 28#define REDUNDANT 1
 29
 30#define MACROREP(x) x
 31#define MACROREP(x) x
 32
 33  class Hello;
 34  class Hello;
 35  
 36  typedef int Int;
 37  typedef int Int;
 38
 39  inline int hello(int);
 40  int hello(int) { return 0; }
 41  
 42  struct B;
 43  
 44  struct A
 45  {
 46    typedef int Int;
 47    friend int foo(A*, B*);    
 48  };
 49
 50  struct B
 51  {
 52    typedef int Int;
 53    friend int foo(A*, B*);
 54  };
 55
 56  inline int foo(A*, B*) { return 0; }
 57  
 58%}
 59
 60
 61#else
 62
 63//
 64// the %extend and %rename directive ALWAYS emit redefined warnings,
 65// since they are not C/C++/CPP standard.
 66//
 67%extend Hello {
 68  int hi(int) { return 0; }
 69}
 70
 71%rename(chao) hi(int);
 72
 73//
 74// All these repeated declarations are really redefinitions,
 75// therefore, swig must produce a redefined warning
 76//
 77
 78%constant int agua = 0;
 79%constant int agua = 1;
 80
 81
 82%inline %{
 83
 84#define REDEFINED 1
 85#define REDEFINED 2
 86
 87#define MACROREP(x) x
 88#define MACROREP(x) x*2
 89
 90  typedef int Int;
 91  typedef double Int;
 92
 93  int hi(int);
 94  int chao(int);
 95  int hello(int);
 96  inline double hello(int) { return 0; }
 97  
 98  struct Hello 
 99  {
100    typedef int Int;
101    typedef double Int;
102    friend short hello(int);
103    int hi(int) { return 0; }
104  };
105  
106%}
107#endif