PageRenderTime 33ms CodeModel.GetById 12ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module name_warnings
  2. /*
  3. This test should produce no warnings at all.
  4. It just show the cases where swig was showing unintended warnings
  5. before.
  6. Right now the test includes some cases for python, java and csharp.
  7. */
  8. /* activate all the name warnings */
  9. %warnfilter(+SWIGWARN_PARSE_KEYWORD,+SWIGWARN_PARSE_BUILTIN_NAME,-SWIGWARN_TYPE_ABSTRACT);
  10. %{
  11. #ifdef max
  12. #undef max
  13. #endif
  14. %}
  15. class string; // csharp keyword
  16. namespace std
  17. {
  18. template <class T>
  19. class complex;
  20. }
  21. %inline
  22. {
  23. class complex; // python built-in
  24. typedef complex None; // python built-in
  25. struct A
  26. {
  27. typedef complex None;
  28. #ifndef SWIGPHP // clone() *is* an invalid method name in PHP.
  29. A* clone(int) { return NULL; }
  30. #endif
  31. virtual ~A() {}
  32. #ifndef SWIGGO // func is a keyword in Go.
  33. virtual int func() = 0;
  34. #endif
  35. private:
  36. typedef complex False;
  37. };
  38. template <class T>
  39. T max (T a, T b) { // python 'max' built-in
  40. return a > b ? a : b;
  41. }
  42. struct B : A
  43. {
  44. B() {}
  45. };
  46. }
  47. %template(max_i) max<int>;
  48. %inline {
  49. /* silently rename the parameter names in csharp/java */
  50. #ifdef SWIGR
  51. double foo(double inparam, double out) { return 1.0; }
  52. #else
  53. double foo(double abstract, double out) { return 1.0; }
  54. #endif
  55. double bar(double native, bool boolean) { return 1.0; }
  56. }