Add regression testcase
This commit is contained in:
parent
f85d87a64c
commit
5d14a7d910
1 changed files with 39 additions and 0 deletions
|
|
@ -388,3 +388,42 @@ TCX_PACKED (typedef struct tcxMessageBugImpl
|
||||||
}) tcxMessageBug;
|
}) tcxMessageBug;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Regression tests for https://github.com/swig/swig/pull/1111
|
||||||
|
%{
|
||||||
|
static int foo_func(int x) { return x; }
|
||||||
|
static int foo_func2() { return 0; }
|
||||||
|
static int bar_func() { return 0; }
|
||||||
|
static int baz_func(int a, int b, int c) { return a + b - c; }
|
||||||
|
%}
|
||||||
|
%inline %{
|
||||||
|
#define FOO(X) int foo_func(X);
|
||||||
|
#define FOO2(X) int foo_func2(X);
|
||||||
|
#define BAR() int bar_func();
|
||||||
|
#define BAR2() int bar_func2()
|
||||||
|
#define BAZ(A,B,C) baz_func(A+0,B,C)
|
||||||
|
#define FOOVAR(...) foo_func(__VA_ARGS__)
|
||||||
|
#define BARVAR(...) bar_func(__VA_ARGS__)
|
||||||
|
#define BAZVAR(...) baz_func(__VA_ARGS__)
|
||||||
|
// This has probably always worked, but make sure that the fix to accept
|
||||||
|
// an empty X doesn't cause this case to be incorrectly expanded:
|
||||||
|
const int FOO = 7;
|
||||||
|
// BAR was incorrectly expanded here, causing:
|
||||||
|
// Error: Syntax error in input(1).
|
||||||
|
const int BAR = 6;
|
||||||
|
// This has probably always worked, but make sure that the fix to accept
|
||||||
|
// an empty X doesn't stop a non-empty X from working:
|
||||||
|
FOO(int x)
|
||||||
|
// FOO() didn't used to get expanded here, causing:
|
||||||
|
// Syntax error in input(1).
|
||||||
|
FOO2()
|
||||||
|
// Check BAR2() still gets expanded here.
|
||||||
|
BAR2() {
|
||||||
|
// Regression test - this used to fail with:
|
||||||
|
// Error: Macro 'BAZ' expects 3 arguments
|
||||||
|
BAZ(,2,3);
|
||||||
|
BARVAR();
|
||||||
|
FOOVAR(1);
|
||||||
|
BAZVAR(1,2,3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue