summaryrefslogtreecommitdiff
path: root/Examples/test-suite/redefined.i
blob: 3022ee9cc2a4284b3a8ad8d6b0c3014599785c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
%module redefined

%warnfilter(SWIGWARN_RUBY_WRONG_NAME) agua;

/* no redundant warnings */
%warnfilter(SWIGWARN_PARSE_REDUNDANT);

#if 1
 //
 // All these repeated declarations are not redefinitions,
 // and they are valid C++ code, therefore, we skip 
 // swig redefined warnings.
 //
%define uja
  aju;
%enddef

%define uja
  aju;
%enddef

%constant int agua = 0;
%constant int agua = 0;

%inline %{

#define REDUNDANT 1
#define REDUNDANT 1

#define MACROREP(x) x
#define MACROREP(x) x

  class Hello;
  class Hello;
  
  typedef int Int;
  typedef int Int;

  inline int hello(int);
  int hello(int) { return 0; }
  
  struct B;
  
  struct A
  {
    typedef int Int;
    friend int foo(A*, B*);    
  };

  struct B
  {
    typedef int Int;
    friend int foo(A*, B*);
  };

  inline int foo(A*, B*) { return 0; }
  
%}


#else

//
// the %extend and %rename directive ALWAYS emit redefined warnings,
// since they are not C/C++/CPP standard.
//
%extend Hello {
  int hi(int) { return 0; }
}

%rename(chao) hi(int);

//
// All these repeated declarations are really redefinitions,
// therefore, swig must produce a redefined warning
//

%constant int agua = 0;
%constant int agua = 1;


%inline %{

#define REDEFINED 1
#define REDEFINED 2

#define MACROREP(x) x
#define MACROREP(x) x*2

  typedef int Int;
  typedef double Int;

  int hi(int);
  int chao(int);
  int hello(int);
  inline double hello(int) { return 0; }
  
  struct Hello 
  {
    typedef int Int;
    typedef double Int;
    friend short hello(int);
    int hi(int) { return 0; }
  };
  
%}
#endif