PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/errors/cpp_macro_locator.i

#
Swig | 103 lines | 90 code | 13 blank | 0 comment | 0 complexity | ab6e4d42a3a64581eb4e0d403cc771c8 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module xxx
  2. // Test the SWIG preprocessor locator effects on reporting line numbers in warnings when processing SWIG (multiline) macros
  3. // The ignored overloaded methods warnings should have the correct line number reporting
  4. // {} blocks are tested, where the preprocessor expands the macros
  5. %define CLASSMACRO(KLASS)
  6. class KLASS
  7. {
  8. public:
  9. KLASS() {}
  10. void methodX(int *) {}
  11. void methodX(const int *) {}
  12. };
  13. %enddef
  14. %{
  15. #define CLASSMACRO(KLASS) \
  16. class KLASS \
  17. { \
  18. public: \
  19. KLASS() {} \
  20. void methodX(int *) {} \
  21. void methodX(const int *) {} \
  22. };
  23. %}
  24. %{
  25. #define VARIABLEMACRO(NAME) double NAME;
  26. struct Outer {
  27. struct Inner {
  28. VARIABLEMACRO(MyInnerVar)
  29. };
  30. };
  31. void overload1(int *) {}
  32. void overload1(const int *) {}
  33. void overload2(int *) {}
  34. void overload2(const int *) {}
  35. void overload3(int *) {}
  36. void overload3(const int *) {}
  37. %}
  38. %define VARIABLEMACRO(NAME)
  39. double NAME;
  40. %enddef
  41. struct Outer {
  42. struct Inner {
  43. VARIABLEMACRO(MyInnerVar)
  44. };
  45. };
  46. void overload1(int *) {}
  47. void overload1(const int *) {}
  48. %fragment("FragmentMethod", "header") {
  49. void fragmentMethod() {
  50. }
  51. VARIABLEMACRO(fragVar)
  52. }
  53. void overload2(int *) {}
  54. void overload2(const int *) {}
  55. %inline {
  56. CLASSMACRO(Klass1)
  57. }
  58. #warning inline warning message one
  59. void overload3(int *) {}
  60. void overload3(const int *) {}
  61. %{
  62. struct Classic {
  63. Classic() {
  64. VARIABLEMACRO(inconstructor)
  65. }
  66. double value;
  67. };
  68. void overload4(int *) {}
  69. void overload4(const int *) {}
  70. void overload5(int *) {}
  71. void overload5(const int *) {}
  72. %}
  73. struct Classic {
  74. Classic() {
  75. VARIABLEMACRO(inconstructor)
  76. }
  77. double value;
  78. };
  79. void overload4(int *) {}
  80. void overload4(const int *) {}
  81. %inline {
  82. void overloadinline1(int *) {}
  83. void overloadinline1(const int *) {}
  84. CLASSMACRO(Klass2)
  85. #warning an inline warning message 2
  86. void overloadinline2(int *) {}
  87. void overloadinline2(const int *) {}
  88. }
  89. void overload5(int *) {}
  90. void overload5(const int *) {}