PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms 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
  1%module xxx
  2
  3// Test the SWIG preprocessor locator effects on reporting line numbers in warnings when processing SWIG (multiline) macros
  4
  5// The ignored overloaded methods warnings should have the correct line number reporting
  6// {} blocks are tested, where the preprocessor expands the macros
  7
  8%define CLASSMACRO(KLASS)
  9class KLASS
 10{
 11public:
 12  KLASS() {}
 13  void methodX(int *) {}
 14  void methodX(const int *) {}
 15};
 16%enddef
 17
 18%{
 19#define CLASSMACRO(KLASS) \
 20class KLASS \
 21{ \
 22public: \
 23  KLASS() {} \
 24  void methodX(int *) {} \
 25  void methodX(const int *) {} \
 26};
 27%}
 28
 29%{
 30#define VARIABLEMACRO(NAME) double NAME;
 31struct Outer {
 32  struct Inner {
 33    VARIABLEMACRO(MyInnerVar)
 34  };
 35};
 36void overload1(int *) {}
 37void overload1(const int *) {}
 38void overload2(int *) {}
 39void overload2(const int *) {}
 40void overload3(int *) {}
 41void overload3(const int *) {}
 42%}
 43
 44%define VARIABLEMACRO(NAME)
 45double NAME;
 46%enddef
 47struct Outer {
 48  struct Inner {
 49    VARIABLEMACRO(MyInnerVar)
 50  };
 51};
 52void overload1(int *) {}
 53void overload1(const int *) {}
 54
 55%fragment("FragmentMethod", "header") {
 56void fragmentMethod() {
 57}
 58VARIABLEMACRO(fragVar)
 59}
 60void overload2(int *) {}
 61void overload2(const int *) {}
 62
 63%inline {
 64CLASSMACRO(Klass1)
 65}
 66#warning inline warning message one
 67void overload3(int *) {}
 68void overload3(const int *) {}
 69
 70%{
 71struct Classic {
 72  Classic() {
 73    VARIABLEMACRO(inconstructor)
 74  }
 75  double value;
 76};
 77void overload4(int *) {}
 78void overload4(const int *) {}
 79void overload5(int *) {}
 80void overload5(const int *) {}
 81%}
 82
 83struct Classic {
 84  Classic() {
 85    VARIABLEMACRO(inconstructor)
 86  }
 87  double value;
 88};
 89void overload4(int *) {}
 90void overload4(const int *) {}
 91
 92%inline {
 93void overloadinline1(int *) {}
 94void overloadinline1(const int *) {}
 95CLASSMACRO(Klass2)
 96#warning an inline warning message 2
 97void overloadinline2(int *) {}
 98void overloadinline2(const int *) {}
 99}
100void overload5(int *) {}
101void overload5(const int *) {}
102
103