PageRenderTime 39ms CodeModel.GetById 14ms 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. %warnfilter(801) agua;
  3. /* no redundant warnings */
  4. %warnfilter(322);
  5. #if 1
  6. //
  7. // All these repeated declarations are not redefinitions,
  8. // and they are valid C++ code, therefore, we skip
  9. // swig redefined warnings.
  10. //
  11. %define uja
  12. aju;
  13. %enddef
  14. %define uja
  15. aju;
  16. %enddef
  17. %constant int agua = 0;
  18. %constant int agua = 0;
  19. %inline %{
  20. #define REDUNDANT 1
  21. #define REDUNDANT 1
  22. #define MACROREP(x) x
  23. #define MACROREP(x) x
  24. class Hello;
  25. class Hello;
  26. typedef int Int;
  27. typedef int Int;
  28. inline int hello(int);
  29. int hello(int) { return 0; }
  30. struct B;
  31. struct A
  32. {
  33. typedef int Int;
  34. friend int foo(A*, B*);
  35. };
  36. struct B
  37. {
  38. typedef int Int;
  39. friend int foo(A*, B*);
  40. };
  41. inline int foo(A*, B*) { return 0; }
  42. %}
  43. #else
  44. //
  45. // the %extend and %rename directive ALWAYS emit redefined warnings,
  46. // since they are not C/C++/CPP standard.
  47. //
  48. %extend Hello {
  49. int hi(int) { return 0; }
  50. }
  51. %rename(chao) hi(int);
  52. //
  53. // All these repeated declarations are really redefinitions,
  54. // therefore, swig must produce a redefined warning
  55. //
  56. %constant int agua = 0;
  57. %constant int agua = 1;
  58. %inline %{
  59. #define REDEFINED 1
  60. #define REDEFINED 2
  61. #define MACROREP(x) x
  62. #define MACROREP(x) x*2
  63. typedef int Int;
  64. typedef double Int;
  65. int hi(int);
  66. int chao(int);
  67. int hello(int);
  68. inline double hello(int) { return 0; }
  69. struct Hello
  70. {
  71. typedef int Int;
  72. typedef double Int;
  73. friend short hello(int);
  74. int hi(int) { return 0; }
  75. };
  76. %}
  77. #endif