parent
69b580dfb6
commit
7a9bf3307f
1 changed files with 38 additions and 39 deletions
|
|
@ -13,11 +13,11 @@
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
//Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
|
/*Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]*/
|
||||||
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
|
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
|
||||||
#endif
|
#endif
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(disable: 4003) // not enough actual parameters for macro 'FOO2'
|
#pragma warning(disable: 4003) /* not enough actual parameters for macro 'FOO2' */
|
||||||
#endif
|
#endif
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -72,14 +72,14 @@ extern "C"
|
||||||
|
|
||||||
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(boolean)
|
TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(boolean)
|
||||||
|
|
||||||
// preproc_3
|
/* preproc_3 */
|
||||||
|
|
||||||
#define Sum( A, B, \
|
#define Sum( A, B, \
|
||||||
C) \
|
C) \
|
||||||
A + B + C
|
A + B + C
|
||||||
|
|
||||||
|
|
||||||
// preproc_4
|
/* preproc_4 */
|
||||||
%{
|
%{
|
||||||
int hello0()
|
int hello0()
|
||||||
{
|
{
|
||||||
|
|
@ -102,33 +102,30 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(boolean)
|
||||||
|
|
||||||
#define HELLO_TYPE(A, B) ARITH_RTYPE(A, ARITH_RTYPE(A,B))
|
#define HELLO_TYPE(A, B) ARITH_RTYPE(A, ARITH_RTYPE(A,B))
|
||||||
|
|
||||||
//
|
|
||||||
// These two work fine
|
|
||||||
//
|
|
||||||
int hello0();
|
int hello0();
|
||||||
ARITH_RTYPE(double,int) hello1();
|
ARITH_RTYPE(double,int) hello1();
|
||||||
|
|
||||||
|
|
||||||
//
|
/*
|
||||||
// This doesn't work with 1.3.17+ ( but it was ok in 1.3.16 )
|
This doesn't work with 1.3.17+ ( but it was ok in 1.3.16 )
|
||||||
// it gets expanded as (using -E)
|
it gets expanded as (using -E)
|
||||||
//
|
|
||||||
// ARITH_RTYPE(double,int) hello2();
|
ARITH_RTYPE(double,int) hello2();
|
||||||
//
|
*/
|
||||||
HELLO_TYPE(double,int) hello2();
|
HELLO_TYPE(double,int) hello2();
|
||||||
|
|
||||||
#define min(x,y) ((x) < (y)) ? (x) : (y)
|
#define min(x,y) ((x) < (y)) ? (x) : (y)
|
||||||
int f(int min);
|
int f(int min);
|
||||||
|
|
||||||
// preproc_5
|
/* preproc_5 */
|
||||||
|
|
||||||
%warnfilter(SWIGWARN_PARSE_REDEFINED) A5; // Ruby, wrong constant name
|
%warnfilter(SWIGWARN_PARSE_REDEFINED) A5; /* Ruby, wrong constant name */
|
||||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) a5; // Ruby, wrong constant name
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) a5; /* Ruby, wrong constant name */
|
||||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) b5; // Ruby, wrong constant name
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) b5; /* Ruby, wrong constant name */
|
||||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) c5; // Ruby, wrong constant name
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) c5; /* Ruby, wrong constant name */
|
||||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) d5; // Ruby, wrong constant name
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) d5; /* Ruby, wrong constant name */
|
||||||
|
|
||||||
// Various preprocessor bits of nastiness.
|
/* Various preprocessor bits of nastiness. */
|
||||||
|
|
||||||
|
|
||||||
/* Test argument name substitution */
|
/* Test argument name substitution */
|
||||||
|
|
@ -138,7 +135,7 @@ int f(int min);
|
||||||
%constant char *a5 = foo(hello,world);
|
%constant char *a5 = foo(hello,world);
|
||||||
%constant int b5 = bar(3,4);
|
%constant int b5 = bar(3,4);
|
||||||
|
|
||||||
// Wrap your brain around this one ;-)
|
/* Wrap your brain around this one ;-) */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#define cat(x,y) x ## y
|
#define cat(x,y) x ## y
|
||||||
|
|
@ -168,7 +165,7 @@ NAME 42
|
||||||
|
|
||||||
#define C4"Hello"
|
#define C4"Hello"
|
||||||
|
|
||||||
// preproc_6
|
/* preproc_6 */
|
||||||
|
|
||||||
%warnfilter(SWIGWARN_PARSE_REDEFINED) A6; /* Ruby, wrong constant name */
|
%warnfilter(SWIGWARN_PARSE_REDEFINED) A6; /* Ruby, wrong constant name */
|
||||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) a6; /* Ruby, wrong constant name */
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) a6; /* Ruby, wrong constant name */
|
||||||
|
|
@ -206,7 +203,7 @@ NAME 42
|
||||||
|
|
||||||
MACRO2(int)
|
MACRO2(int)
|
||||||
|
|
||||||
// cpp_macro_noarg. Tests to make sure macros with no arguments work right.
|
/* cpp_macro_noarg. Tests to make sure macros with no arguments work right. */
|
||||||
#define MACROWITHARG(x) something(x)
|
#define MACROWITHARG(x) something(x)
|
||||||
|
|
||||||
typedef int MACROWITHARG;
|
typedef int MACROWITHARG;
|
||||||
|
|
@ -373,8 +370,10 @@ int methodX(int x);
|
||||||
int methodX(int x) { return x+100; }
|
int methodX(int x) { return x+100; }
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Comma in macro - https://github.com/swig/swig/issues/974 (for /* */)
|
/*
|
||||||
// and https://github.com/swig/swig/pull/1166 (for //)
|
Comma in macro - https://github.com/swig/swig/issues/974 (for C comments)
|
||||||
|
and https://github.com/swig/swig/pull/1166 (for //)
|
||||||
|
*/
|
||||||
%inline %{
|
%inline %{
|
||||||
#define swig__attribute__(x)
|
#define swig__attribute__(x)
|
||||||
#define TCX_PACKED(d) d swig__attribute__ ((__packed__))
|
#define TCX_PACKED(d) d swig__attribute__ ((__packed__))
|
||||||
|
|
@ -394,19 +393,19 @@ TCX_PACKED (typedef struct tcxMessageBugImpl
|
||||||
|
|
||||||
TCX_PACKED (typedef struct tcxMessageTestImpl2
|
TCX_PACKED (typedef struct tcxMessageTestImpl2
|
||||||
{
|
{
|
||||||
int mHeader; ///< comment
|
int mHeader; /**< comment */
|
||||||
}) tcxMessageTest2;
|
}) tcxMessageTest2;
|
||||||
|
|
||||||
|
|
||||||
TCX_PACKED (typedef struct tcxMessageBugImpl2
|
TCX_PACKED (typedef struct tcxMessageBugImpl2
|
||||||
{
|
{
|
||||||
int mBid; ///< Bid price and size, check PresentMap if available in message
|
int mBid; /**< Bid price and size, check PresentMap if available in message */
|
||||||
}) tcxMessageBug2;
|
}) tcxMessageBug2;
|
||||||
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Regression tests for https://github.com/swig/swig/pull/1111
|
/* Regression tests for https://github.com/swig/swig/pull/1111 */
|
||||||
%{
|
%{
|
||||||
static int foo_func(int x) { return x; }
|
static int foo_func(int x) { return x; }
|
||||||
static int foo_func2() { return 0; }
|
static int foo_func2() { return 0; }
|
||||||
|
|
@ -422,22 +421,22 @@ static int baz_func(int a, int b, int c) { return a + b - c; }
|
||||||
#define FOOVAR(...) foo_func(__VA_ARGS__)
|
#define FOOVAR(...) foo_func(__VA_ARGS__)
|
||||||
#define BARVAR(...) bar_func(__VA_ARGS__)
|
#define BARVAR(...) bar_func(__VA_ARGS__)
|
||||||
#define BAZVAR(...) baz_func(__VA_ARGS__)
|
#define BAZVAR(...) baz_func(__VA_ARGS__)
|
||||||
// This has probably always worked, but make sure that the fix to accept
|
/* 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:
|
an empty X doesn't cause this case to be incorrectly expanded:*/
|
||||||
const int FOO = 7;
|
const int FOO = 7;
|
||||||
// BAR was incorrectly expanded here, causing:
|
/* BAR was incorrectly expanded here, causing:
|
||||||
// Error: Syntax error in input(1).
|
Error: Syntax error in input(1). */
|
||||||
const int BAR = 6;
|
const int BAR = 6;
|
||||||
// This has probably always worked, but make sure that the fix to accept
|
/* 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:
|
an empty X doesn't stop a non-empty X from working: */
|
||||||
FOO(int x)
|
FOO(int x)
|
||||||
// FOO() didn't used to get expanded here, causing:
|
/* FOO() didn't used to get expanded here, causing:
|
||||||
// Syntax error in input(1).
|
Syntax error in input(1). */
|
||||||
FOO2()
|
FOO2()
|
||||||
// Check BAR2() still gets expanded here.
|
/* Check BAR2() still gets expanded here. */
|
||||||
BAR2() {
|
BAR2() {
|
||||||
// Regression test - this used to fail with:
|
/* Regression test - this used to fail with:
|
||||||
// Error: Macro 'BAZ' expects 3 arguments
|
Error: Macro 'BAZ' expects 3 arguments */
|
||||||
BAZ(,2,3);
|
BAZ(,2,3);
|
||||||
BARVAR();
|
BARVAR();
|
||||||
FOOVAR(1);
|
FOOVAR(1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue