Merge branch 'master' into vadz-doxygen

* master:
  Add Octave 4.4 to Travis allow_failures
  Fixes for appveyor image changes
  Javascript test-suite Makefile parallel jobs
  Add changes entry for csconstruct, dconstruct and javaconstruct fix
  Fix lookup of csconstruct, dconstructor and javaconstruct typemaps
  Javascript %nspace fix in generated C++ code
  Add C++17 documentation chapter
  Add changes notes for C++17 nested namespaces support
  Test for invalid C++17 nested namespace aliases
  Test c++17 nested namespaces and %nspace
  Add c++17 nested namespaces runtime test for C#
  Add c++17 nested namespaces runtime test for Python
  Add support for c++17 nested namespaces
  Update CHANGES.current
  .travis.yml: test against Octave 4.4
  Examples/test-suite/register_par.i: rename 'tree' to 'swig_tree'
  Examples/octave/module_load/runme.m: update 'exist()' statements for Octave >= 4.4
  Examples/octave/module_load/runme.m: do not use duplicate function names
  Examples/Makefile.in: unset OCTAVE_PATH when running Octave for tests
  Lib/octave: fix getting/setting global variables for Octave >= 4.4
  Lib/octave: use new class for function member dereference with Octave >= 4.4
  Lib/octave: fix operator installation for Octave >= 4.4
  Lib/Octave: in Octave >= 4.4, assign reference to base class in subclass
  Lib/octave: fix call to mlock() for Octave >= 4.4
  Lib/octave: fix call to octave::call_stack::current() for Octave >= 4.4
  Lib/octave: 'octave_exit' not longer exists in Octave >= 4.4
  Lib/octave: replace is_bool_type() with islogical() for Octave >= 4.4
  Lib/octave: replace is_numeric_type() with isnumeric() for Octave >= 4.4
  Lib/octave: replace is_cell() with iscell() for Octave >= 4.4
  Lib/octave: call octave::feval() instead of feval() for Octave >= 4.4
  Lib/octave: fix function name passed to unwind_protect::begin_frame()
  C#, D, Java methodmodifiers on destructors
  Javascript assert.h - move to header section
  Appveyor cl compiler warning fixes during configure
  Java vector wrappers cast correction
  test-suite fixes (Java directors) for compilers that don't support varargs
  Go - use director.swg like other languages
  test-suite fixes (2) for compilers that don't support varargs
  Consistent spacing in generated exception specifications
  test-suite fixes for compilers that don't support vararg macros
  Enhance Travis testing to use gcc 8 and test C++17 and C17
  Enhance SWIG_isfinite for older standards: C++03/C++98/C89
  test-suite support for gcc-8 targeting C++11 and C++14
  Scilab portability fixes - remove use of strdup
  Scilab array overbounds fix handling char type exceptions
  test-suite fix for c++17 and throw macro
  Remove use of 'register' in C source
  test-suite support for C++17: switch testing of the deprecated C++17 'register' keyword from C++ to C
  Examples update to support C++17: exception specification throw removal
  Cosmetic syntax tweak using throw in Octave directors
  test-suite support for C++17 (Java): exception specification throw removal
  test-suite support for C++17: exception specification throw removal
  __cplusplus macro usage tweak
  Improve detection of Python's 2to3 tool
  Correct C shared library creation when specifing CC to configure
  Remove superfluous parens in generated Python scripts.
  [ci] guile 2.2 build no longer expected to fail
  guile - resstructure some configure tests
  Disable guile configuration if guile-config and guile report a different version
  Fix guile executable detection on early 2.0.x guile versions
  guile - drop GDB_INTERFACE related stuff
  guile - replace obsolete scm_listify with scm_list_n
  guile - use more reliable method of finding guile executable based on guile-config
  Fix go version matching in configure for go1.10
  [Python] Suppress new pycodestyle warning
  Add if-no-present action for jsv8inc arg
  Fix typo in help --with-jscoreinc and --with-jscorelib
  Fix off-by-one error
  * Makefile.in (configfiles): Update URLs for latest configfiles.
  Add changes entry for Ruby %alias fix for global functions
  [Ruby] Pass Qnil instead of NULL to rb_funcall()
  Fix typo
  Fix ruby %alias directive for native c functions
  Stop testing Python on Appveyor msys/mingw
  Fix -Wimplicit-fallthrough gcc-7.3 warning
This commit is contained in:
William S Fulton 2018-05-17 19:57:02 +01:00
commit 0cfd53cff7
136 changed files with 2767 additions and 1956 deletions

View file

@ -1,13 +1,9 @@
%module catches
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW3(T1, T2, T3)
%}
%include <exception.i> // for throws(...) typemap
@ -27,7 +23,7 @@ void test_catches(int i) {
throw ThreeException();
}
}
void test_exception_specification(int i) throw(int, const char *, const ThreeException&) {
void test_exception_specification(int i) TESTCASE_THROW3(int, const char *, const ThreeException&) {
test_catches(i);
}
void test_catches_all(int i) {
@ -35,11 +31,3 @@ void test_catches_all(int i) {
}
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -162,6 +162,8 @@ CPP_TEST_CASES += \
cpp_nodefault \
cpp_static \
cpp_typedef \
cpp17_nested_namespaces \
cpp17_nspace_nested_namespaces \
curiously_recurring_template_pattern \
default_args \
default_arg_expressions \
@ -170,6 +172,7 @@ CPP_TEST_CASES += \
defvalue_constructor \
derived_byvalue \
derived_nested \
destructor_methodmodifiers \
destructor_reprotected \
director_abstract \
director_alternating \
@ -183,6 +186,7 @@ CPP_TEST_CASES += \
director_enum \
director_exception \
director_exception_catches \
director_exception_nothrow \
director_extend \
director_finalizer \
director_frob \
@ -352,7 +356,6 @@ CPP_TEST_CASES += \
redefined_not \
refcount \
reference_global_vars \
register_par \
rename1 \
rename2 \
rename3 \
@ -695,6 +698,7 @@ C_TEST_CASES += \
preproc_defined \
preproc_include \
preproc_line_file \
register_par \
ret_by_value \
simple_array \
sizeof_pointer \

View file

@ -5,14 +5,10 @@
%module cplusplus_throw
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%nodefaultctor;
@ -24,17 +20,9 @@ class Foo { };
class Bar {
public:
void baz() const { };
void foo() throw (Foo) { };
void bazfoo() const throw (int) { };
void foo() TESTCASE_THROW1(Foo) { };
void bazfoo() const TESTCASE_THROW1(int) { };
};
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -6,14 +6,10 @@
%warnfilter(SWIGWARN_PARSE_KEYWORD) final; // 'final' is a java keyword, renaming to '_final'
%warnfilter(SWIGWARN_PARSE_KEYWORD) override; // 'override' is a C# keyword, renaming to '_override'
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%inline %{
@ -43,8 +39,8 @@ struct Derived /*final*/ : Base {
virtual void finaloverride2() override final {}
virtual void finaloverride3() noexcept override final {}
virtual void finaloverride4() const noexcept override final {}
virtual void finaloverride5() throw(int) override final {}
virtual void finaloverride6() const throw(int) override final {}
virtual void finaloverride5() TESTCASE_THROW1(int) override final {}
virtual void finaloverride6() const TESTCASE_THROW1(int) override final {}
virtual ~Derived() override final {}
};
void Derived::override2() const noexcept {}
@ -142,11 +138,3 @@ void DerivedNoVirtualStruct::ef() {}
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -26,14 +26,12 @@
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::lambda19;
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::Space2::lambda20;
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW0() throw()
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW0()
#define TESTCASE_THROW1(T1)
%}
%inline %{
@ -61,22 +59,27 @@ void fn() {
}
auto lambda6 = [] (int a, int b) mutable { return a + b; };
auto lambda7 = [] (int x, int y) -> int { return x+y; };
auto lambda8 = [] (int x, int y) throw() -> int { return x+y; };
auto lambda9 = [] (int x, int y) mutable throw() -> int { return x+y; };
auto lambda10 = [] (int x, int y) throw(int) { return x+y; };
auto lambda11 = [] (int x, int y) mutable throw(int) { return x+y; };
auto lambda8 = [] (int x, int y) TESTCASE_THROW0() -> int { return x+y; };
auto lambda9 = [] (int x, int y) mutable TESTCASE_THROW0() -> int { return x+y; };
auto lambda10 = [] (int x, int y) TESTCASE_THROW1(int) { return x+y; };
auto lambda11 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
auto lambda12 = [] (int a, int b) { return a + b; }(1, 2);
auto lambda13 = [] (int a, int b) mutable { return a + b; }(1, 2);
auto lambda14 = [] () throw () {};
auto lambda15 = [] () mutable throw () {};
auto lambda14 = [] () TESTCASE_THROW0() {};
auto lambda15 = [] () mutable TESTCASE_THROW0() {};
auto lambda16 = [] { return thing; };
auto lambda17 = [] { return thing; }();
constexpr auto lambda18 = [] (int x, int y) mutable throw(int) { return x+y; };
#if defined(SWIG) || (defined(__cplusplus) && __cplusplus >= 201703L)
#define CONSTEXPR constexpr
#else
#define CONSTEXPR
#endif
CONSTEXPR auto lambda18 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
namespace Space1 {
constexpr auto lambda19 = [] (int x, int y) mutable throw(int) { return x+y; };
CONSTEXPR auto lambda19 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
namespace Space2 {
constexpr auto lambda20 = [] (int x, int y) mutable throw(int) { return x+y; };
CONSTEXPR auto lambda20 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
}
}
@ -115,11 +118,3 @@ int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
void lambda_init(int = ([=]{ return 0; })());
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -0,0 +1,199 @@
%module cpp17_nested_namespaces
// Tests c++17 style nested namespaces
// Tests are designed so that code compiles with C++98 compilers
#define CPP17 1
%{
#if __cplusplus >= 201703L
#define CPP17 1
#endif
%}
%inline %{
// Tests with namespaces already defined using C++98 style (non-nested) namespaces
namespace A1 {
struct A1Struct {
void A1Method() {}
};
namespace B1 {
struct B1Struct {
void B1Method() {}
};
}
}
#if defined(CPP17)
namespace A1::B1 {
#else
namespace A1 {
namespace B1 {
#endif
A1Struct createA1Struct() { return ::A1::A1Struct(); }
B1Struct createB1Struct() { return ::A1::B1::B1Struct(); }
#if !defined(CPP17)
}
}
#else
}
#endif
namespace A1 {
namespace B1 {
namespace C1 {
struct C1Struct {
void C1Method() {}
};
}
}
}
#if defined(CPP17)
namespace A1::B1::C1 {
#else
namespace A1 {
namespace B1 {
namespace C1 {
#endif
C1Struct createC1Struct() { return ::A1::B1::C1::C1Struct(); }
#if !defined(CPP17)
}
}
}
#else
}
#endif
%}
%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces
#if defined(CPP17)
namespace A2::B2 {
#else
namespace A2 {
namespace B2 {
#endif
struct B2Struct {
void B2Method() {}
};
#if !defined(CPP17)
}
}
#else
}
#endif
#if defined(CPP17)
namespace A2::B2 {
#else
namespace A2 {
namespace B2 {
#endif
B2Struct createB2Struct() { return ::A2::B2::B2Struct(); }
#if !defined(CPP17)
}
}
#else
}
#endif
#if defined(CPP17)
namespace A2::B2::C2 {
#else
namespace A2 {
namespace B2 {
namespace C2 {
#endif
struct C2Struct {
void C2Method() {}
};
#if !defined(CPP17)
}
}
}
#else
}
#endif
#if defined(CPP17)
namespace A2::B2::C2 {
#else
namespace A2 {
namespace B2 {
namespace C2 {
#endif
C2Struct createC2Struct() { return ::A2::B2::C2::C2Struct(); }
#if !defined(CPP17)
}
}
}
#else
}
#endif
%}
%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces to 3 levels
#if defined(CPP17)
namespace A3::B3::C3 {
#else
namespace A3 {
namespace B3 {
namespace C3 {
#endif
struct C3Struct {
void C3Method() {}
};
#if !defined(CPP17)
}
}
}
#else
}
#endif
#if defined(CPP17)
namespace A3::B3::C3 {
#else
namespace A3 {
namespace B3 {
namespace C3 {
#endif
C3Struct createC3Struct() { return ::A3::B3::C3::C3Struct(); }
#if !defined(CPP17)
}
}
}
#else
}
#endif
#if defined(CPP17)
namespace A3::B3 {
#else
namespace A3 {
namespace B3 {
#endif
struct B3Struct {
void B3Method() {}
};
#if !defined(CPP17)
}
}
#else
}
#endif
#if defined(CPP17)
namespace A3::B3 {
#else
namespace A3 {
namespace B3 {
#endif
B3Struct createB3Struct() { return ::A3::B3::B3Struct(); }
#if !defined(CPP17)
}
}
#else
}
#endif
%}

View file

@ -0,0 +1,13 @@
%module cpp17_nspace_nested_namespaces
#if defined(SWIGJAVA)
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
#endif
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace;
#endif
%include "cpp17_nested_namespaces.i"

View file

@ -0,0 +1,25 @@
using System;
using cpp17_nested_namespacesNamespace;
public class cpp17_nested_namespaces_runme
{
static void Main()
{
new A1Struct().A1Method();
new B1Struct().B1Method();
new C1Struct().C1Method();
cpp17_nested_namespaces.createA1Struct().A1Method();
cpp17_nested_namespaces.createB1Struct().B1Method();
cpp17_nested_namespaces.createC1Struct().C1Method();
new B2Struct().B2Method();
new C2Struct().C2Method();
cpp17_nested_namespaces.createB2Struct().B2Method();
cpp17_nested_namespaces.createC2Struct().C2Method();
new B3Struct().B3Method();
new C3Struct().C3Method();
cpp17_nested_namespaces.createB3Struct().B3Method();
cpp17_nested_namespaces.createC3Struct().C3Method();
}
}

View file

@ -0,0 +1,25 @@
using System;
using cpp17_nspace_nested_namespacesNamespace;
public class cpp17_nspace_nested_namespaces_runme
{
static void Main()
{
new cpp17_nspace_nested_namespacesNamespace.A1.A1Struct().A1Method();
new cpp17_nspace_nested_namespacesNamespace.A1.B1.B1Struct().B1Method();
new cpp17_nspace_nested_namespacesNamespace.A1.B1.C1.C1Struct().C1Method();
cpp17_nspace_nested_namespaces.createA1Struct().A1Method();
cpp17_nspace_nested_namespaces.createB1Struct().B1Method();
cpp17_nspace_nested_namespaces.createC1Struct().C1Method();
new cpp17_nspace_nested_namespacesNamespace.A2.B2.B2Struct().B2Method();
new cpp17_nspace_nested_namespacesNamespace.A2.B2.C2.C2Struct().C2Method();
cpp17_nspace_nested_namespaces.createB2Struct().B2Method();
cpp17_nspace_nested_namespaces.createC2Struct().C2Method();
new cpp17_nspace_nested_namespacesNamespace.A3.B3.B3Struct().B3Method();
new cpp17_nspace_nested_namespacesNamespace.A3.B3.C3.C3Struct().C3Method();
cpp17_nspace_nested_namespaces.createB3Struct().B3Method();
cpp17_nspace_nested_namespaces.createC3Struct().C3Method();
}
}

View file

@ -1,5 +1,11 @@
%module csharp_exceptions
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#define TESTCASE_THROW1(T1)
%}
%include <exception.i>
%inline %{
@ -36,25 +42,16 @@
}
%inline %{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
// %exception tests
void ThrowByValue() { throw Ex("ThrowByValue"); }
void ThrowByReference() { throw Ex("ThrowByReference"); }
// %csnothrowexception
void NoThrowException() { throw Ex("NoThrowException"); }
// exception specifications
void ExceptionSpecificationValue() throw(Ex) { throw Ex("ExceptionSpecificationValue"); }
void ExceptionSpecificationReference() throw(Ex&) { throw Ex("ExceptionSpecificationReference"); }
void ExceptionSpecificationString() throw(const char *) { throw "ExceptionSpecificationString"; }
void ExceptionSpecificationInteger() throw(int) { throw 20; }
void ExceptionSpecificationValue() TESTCASE_THROW1(Ex) { throw Ex("ExceptionSpecificationValue"); }
void ExceptionSpecificationReference() TESTCASE_THROW1(Ex&) { throw Ex("ExceptionSpecificationReference"); }
void ExceptionSpecificationString() TESTCASE_THROW1(const char *) { throw "ExceptionSpecificationString"; }
void ExceptionSpecificationInteger() TESTCASE_THROW1(int) { throw 20; }
%}
// test exceptions in the default typemaps
@ -68,15 +65,15 @@ void NullValue(Ex e) {}
// enums
%inline %{
enum TestEnum {TestEnumItem};
void ExceptionSpecificationEnumValue() throw(TestEnum) { throw TestEnumItem; }
void ExceptionSpecificationEnumReference() throw(TestEnum&) { throw TestEnumItem; }
void ExceptionSpecificationEnumValue() TESTCASE_THROW1(TestEnum) { throw TestEnumItem; }
void ExceptionSpecificationEnumReference() TESTCASE_THROW1(TestEnum&) { throw TestEnumItem; }
%}
// std::string
%include <std_string.i>
%inline %{
void ExceptionSpecificationStdStringValue() throw(std::string) { throw std::string("ExceptionSpecificationStdStringValue"); }
void ExceptionSpecificationStdStringReference() throw(const std::string&) { throw std::string("ExceptionSpecificationStdStringReference"); }
void ExceptionSpecificationStdStringValue() TESTCASE_THROW1(std::string) { throw std::string("ExceptionSpecificationStdStringValue"); }
void ExceptionSpecificationStdStringReference() TESTCASE_THROW1(const std::string&) { throw std::string("ExceptionSpecificationStdStringReference"); }
void NullStdStringValue(std::string s) {}
void NullStdStringReference(std::string &s) {}
%}
@ -108,12 +105,8 @@ void MemoryLeakCheck() {
%inline %{
struct constructor {
constructor(std::string s) {}
constructor() throw(int) { throw 10; }
constructor() TESTCASE_THROW1(int) { throw 10; }
};
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
%}
// test exception pending in the csout typemaps
@ -244,11 +237,3 @@ struct ThrowsClass {
void InnerExceptionTest() { throw Ex("My InnerException message"); }
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -4,13 +4,16 @@
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
%}
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
#define TESTCASE_THROW1(T1)
#define TESTCASE_THROW2(T1, T2)
%}
%include <std_string.i>
@ -203,18 +206,18 @@
// Default parameters with exception specifications
%inline %{
void exceptionspec(int a = -1) throw (int, const char*) {
void exceptionspec(int a = -1) TESTCASE_THROW2(int, const char*) {
if (a == -1)
throw "ciao";
else
throw a;
}
struct Except {
Except(bool throwException, int a = -1) throw (int) {
Except(bool throwException, int a = -1) TESTCASE_THROW1(int) {
if (throwException)
throw a;
}
void exspec(int a = 0) throw (int, const char*) {
void exspec(int a = 0) TESTCASE_THROW2(int, const char*) {
::exceptionspec(a);
}
};
@ -326,11 +329,3 @@ struct CDA {
};
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -0,0 +1,61 @@
%module destructor_methodmodifiers
// This test changes the proxy classes so that they cannot be inherited from in the target language
// Previously the %csmethodmodifiers, %dmethodmodifiers, %javamethodmodifiers on destructors were ignored
// Now they can control the dispose/Dispose/delete method modifiers
#if defined(SWIGCSHARP)
// remove all use of protected and virtual keywords
%typemap(csclassmodifiers) NotForDeriving1, NotForDeriving2 "public sealed class"
%csmethodmodifiers NotForDeriving1::~NotForDeriving1 "public /*not virtual nor override*/";
%csmethodmodifiers NotForDeriving2::~NotForDeriving2 "public /*not virtual nor override*/";
// remove protected keyword to remove compiler warning
%typemap(csbody) NotForDeriving1, NotForDeriving2 %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private /*protected*/ bool swigCMemOwn;
internal $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
#elif defined(SWIGD)
%typemap(dclassmodifiers) NotForDeriving1, NotForDeriving2 "final class"
%dmethodmodifiers NotForDeriving1::~NotForDeriving1 "public final";
%dmethodmodifiers NotForDeriving2::~NotForDeriving2 "public final";
#elif defined(SWIGJAVA)
%typemap(javaclassmodifiers) NotForDeriving1, NotForDeriving2 "public final class"
%javamethodmodifiers NotForDeriving1::~NotForDeriving1 "public synchronized final";
%javamethodmodifiers NotForDeriving2::~NotForDeriving2 "public synchronized final";
#endif
%inline %{
//#include <iostream>
struct NotForDeriving1 {
void notvirtual() {}
~NotForDeriving1() {
// std::cout << "~NotForDeriving1 called" << std::endl;
}
};
struct NotForDeriving2 {
void notvirtual() {}
#if defined(SWIG)
%extend {
~NotForDeriving2() {
// std::cout << "~NotForDeriving2 called" << std::endl;
}
}
#endif
};
%}

View file

@ -3,18 +3,8 @@
%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) return_const_char_star;
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#include <string>
// define dummy director exception classes to prevent spurious errors
// in target languages that do not support directors.
@ -125,6 +115,18 @@ Foo *launder(Foo *f) {
%feature("director") Bar;
%feature("director") ReturnAllTypes;
%{
// throw is deprecated in C++11 and invalid in C++17 and later
#if defined(__cplusplus) && __cplusplus >= 201103L
#define throw(TYPE1, TYPE2, TYPE3)
#else
#define throw(TYPE1, TYPE2, TYPE3) throw(TYPE1, TYPE2, TYPE3)
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#endif
%}
%inline %{
struct Exception1
{
@ -137,16 +139,15 @@ Foo *launder(Foo *f) {
class Base
{
public:
virtual ~Base() throw () {}
virtual ~Base() {}
};
class Bar : public Base
{
public:
virtual std::string ping() throw (Exception1, Exception2&) { return "Bar::ping()"; }
virtual std::string pong() throw (Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
virtual std::string pang() throw () { return "Bar::pang()"; }
virtual std::string ping() throw(Exception1, Exception2&, double) { return "Bar::ping()"; }
virtual std::string pong() throw(Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
};
// Class to allow regression testing SWIG/PHP not checking if an exception

View file

@ -0,0 +1,28 @@
%module(directors="1") director_exception_nothrow
%include "std_string.i"
%feature("director") Bar;
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
%}
%inline %{
#include <string>
class Base
{
public:
virtual ~Base() throw() {}
};
class Bar : public Base
{
public:
virtual std::string pang() throw() { return "Bar::pang()"; }
};
%}

View file

@ -0,0 +1,34 @@
%module cpp_nested_namespace_alias
// C++17 nested namespaces
namespace A
{
namespace B
{
void ab1();
}
}
namespace A::B
{
void ab2();
}
namespace AAlias = A;
namespace AAlias::B
{
void ab3();
}
namespace A
{
namespace BAlias = B;
void ab4();
}
namespace A::BAlias
{
void ab5();
}
namespace ABAlias = A::B;
namespace ABAlias
{
void ab6();
}

View file

@ -0,0 +1,3 @@
cpp_nested_namespace_alias.i:18: Warning 308: Namespace alias 'AAlias' not allowed here. Assuming 'A'
cpp_nested_namespace_alias.i:27: Warning 308: Namespace alias 'BAlias' not allowed here. Assuming 'B'
cpp_nested_namespace_alias.i:32: Warning 308: Namespace alias 'ABAlias' not allowed here. Assuming 'B'

View file

@ -12,14 +12,10 @@
%include "exception.i"
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
/*
@ -103,16 +99,16 @@
int efoovar;
/* caught by the user's throw definition */
int foo() throw(E1)
int foo() TESTCASE_THROW1(E1)
{
throw E1();
return 0;
return 0;
}
int bar() throw(E2)
int bar() TESTCASE_THROW1(E2)
{
throw E2();
return 0;
return 0;
}
/* caught by %postexception */
@ -151,11 +147,3 @@ bool is_python_builtin() { return false; }
%template(ET_i) ET<int>;
%template(ET_d) ET<double>;
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -2,14 +2,10 @@
// This produced compilable code for Tcl, Python in 1.3.27, fails in 1.3.29
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%{
@ -40,8 +36,8 @@ class ex2 : public myException
class Impl
{
public:
void f1() throw (myException) { ex1 e; throw e; }
void f2() throw (myException) { ex2 e; throw e; }
void f1() TESTCASE_THROW1(myException) { ex1 e; throw e; }
void f2() TESTCASE_THROW1(myException) { ex2 e; throw e; }
};
%}
@ -53,11 +49,3 @@ class Impl
#warning "UTL needs fixing for partial exception information"
#endif
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -1,30 +1,18 @@
%module extern_throws
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%inline %{
#include <exception>
extern int get() throw(std::exception);
extern int get() TESTCASE_THROW1(std::exception);
%}
%{
int get() throw(std::exception) { return 0; }
int get() TESTCASE_THROW1(std::exception) { return 0; }
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -4,6 +4,12 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR);
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
#define TESTCASE_THROW2(T1, T2)
%}
// change the access to the intermediary class for testing purposes
%pragma(java) jniclassclassmodifiers="public class";
%pragma(csharp) imclassclassmodifiers="public class";
@ -41,14 +47,6 @@ template<class T> class vector {
void testconst(const T x) { }
};
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
class Base {
public:
Base() : mVectInt(0) {}
@ -69,14 +67,8 @@ public:
virtual Base& m1(Base &b) { return b; }
virtual Base* m2(Base *b) { return b; }
// virtual Base m3(Base b) { return b; }
void throwspec() throw (int, Base) {}
void throwspec() TESTCASE_THROW2(int, Base) {}
};
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}
%template(maxint) maximum<int>;

View file

@ -68,6 +68,7 @@ JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE)
SWIGOPT += $(JAVA_PACKAGEOPT)
# Custom tests - tests with additional commandline options
cpp17_nspace_nested_namespaces.%: JAVA_PACKAGE = $*Package
director_nspace.%: JAVA_PACKAGE = $*Package
director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
java_director_exception_feature_nspace.%: JAVA_PACKAGE = $*Package

View file

@ -0,0 +1,32 @@
import cpp17_nested_namespaces.*;
public class cpp17_nested_namespaces_runme {
static {
try {
System.loadLibrary("cpp17_nested_namespaces");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
new A1Struct().A1Method();
new B1Struct().B1Method();
new C1Struct().C1Method();
cpp17_nested_namespaces.createA1Struct().A1Method();
cpp17_nested_namespaces.createB1Struct().B1Method();
cpp17_nested_namespaces.createC1Struct().C1Method();
new B2Struct().B2Method();
new C2Struct().C2Method();
cpp17_nested_namespaces.createB2Struct().B2Method();
cpp17_nested_namespaces.createC2Struct().C2Method();
new B3Struct().B3Method();
new C3Struct().C3Method();
cpp17_nested_namespaces.createB3Struct().B3Method();
cpp17_nested_namespaces.createC3Struct().C3Method();
}
}

View file

@ -0,0 +1,30 @@
public class cpp17_nspace_nested_namespaces_runme {
static {
try {
System.loadLibrary("cpp17_nspace_nested_namespaces");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
new cpp17_nspace_nested_namespacesPackage.A1.A1Struct().A1Method();
new cpp17_nspace_nested_namespacesPackage.A1.B1.B1Struct().B1Method();
new cpp17_nspace_nested_namespacesPackage.A1.B1.C1.C1Struct().C1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createA1Struct().A1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB1Struct().B1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC1Struct().C1Method();
new cpp17_nspace_nested_namespacesPackage.A2.B2.B2Struct().B2Method();
new cpp17_nspace_nested_namespacesPackage.A2.B2.C2.C2Struct().C2Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB2Struct().B2Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC2Struct().C2Method();
new cpp17_nspace_nested_namespacesPackage.A3.B3.B3Struct().B3Method();
new cpp17_nspace_nested_namespacesPackage.A3.B3.C3.C3Struct().C3Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB3Struct().B3Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC3Struct().C3Method();
}
}

View file

@ -4,16 +4,6 @@
%warnfilter(SWIGWARN_TYPEMAP_DIRECTORTHROWS_UNDEF) MyNS::Foo::directorthrows_warning;
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
%}
%include <std_string.i>
// DEFINE exceptions in header section using std::runtime_error
@ -175,6 +165,18 @@ namespace MyNS {
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Foo::pong;
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Bar::pong;
%{
// throw is deprecated in C++11 and invalid in C++17 and later
#if defined(__cplusplus) && __cplusplus >= 201103L
#define throw(TYPE1, TYPE2)
#else
#define throw(TYPE1, TYPE2) throw(TYPE1, TYPE2)
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#endif
%}
%inline %{
namespace MyNS {
@ -187,7 +189,7 @@ public:
virtual std::string ping(int excp) throw(int,MyNS::Exception2) = 0;
virtual std::string pong(int excp) /* throws MyNS::Exception1 MyNS::Exception2 MyNS::Unexpected) */ = 0;
virtual std::string genericpong(int excp) /* unspecified throws - exception is always DirectorException in C++, translated back to whatever thrown in java */ = 0;
virtual std::string directorthrows_warning(int excp) throw(double) { return std::string(); }
virtual std::string directorthrows_warning(int excp) throw(int,double) { return std::string(); }
};
// Make a bar from a foo, so a call to Java Bar

View file

@ -11,16 +11,6 @@
#define PACKAGESLASH "java_director_exception_feature_nspacePackage/"
%}
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
%}
%include <std_string.i>
// DEFINE exceptions in header section using std::runtime_error
@ -182,6 +172,18 @@ namespace MyNS {
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Foo::pong;
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Bar::pong;
%{
// throw is deprecated in C++11 and invalid in C++17 and later
#if defined(__cplusplus) && __cplusplus >= 201103L
#define throw(TYPE1, TYPE2)
#else
#define throw(TYPE1, TYPE2) throw(TYPE1, TYPE2)
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#endif
%}
%inline %{
namespace MyNS {

View file

@ -2,6 +2,12 @@
%module java_throws
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#define TESTCASE_THROW1(T1)
%}
// Exceptions are chosen at random but are ones which have to have a try catch block to compile
%typemap(in, throws=" ClassNotFoundException") int num {
$1 = (int)$input;
@ -39,22 +45,7 @@ short full_of_exceptions(int num) {
return $null;
}
%inline %{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
bool throw_spec_function(int value) throw (int) { throw (int)0; }
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
bool throw_spec_function(int value) TESTCASE_THROW1(int) { throw (int)0; }
%}
%catches(int) catches_function(int value);

View file

@ -66,14 +66,14 @@ ifeq (node,$(JSENGINE))
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='-javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i' swiginvoke && \
$(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
swig_and_compile_cpp = \
$(setup_node) && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='-c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i' swiginvoke && \
$(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
@ -83,12 +83,12 @@ ifeq (node,$(JSENGINE))
%.ctest:
$(_setup)
$(swig_and_compile_c)
+$(swig_and_compile_c)
$(run_testcase)
%.cpptest:
$(_setup)
$(swig_and_compile_cpp)
+$(swig_and_compile_cpp)
$(run_testcase)
%.multicpptest:

View file

@ -2,17 +2,12 @@
%include <std_except.i>
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%inline %{
struct E1 : public std::exception
{
@ -23,32 +18,23 @@
};
struct Test {
int foo1() throw(std::bad_exception) { return 0; }
int foo2() throw(std::logic_error) { return 0; }
int foo3() throw(E1) { return 0; }
int foo4() throw(E2) { return 0; }
int foo1() TESTCASE_THROW1(std::bad_exception) { return 0; }
int foo2() TESTCASE_THROW1(std::logic_error) { return 0; }
int foo3() TESTCASE_THROW1(E1) { return 0; }
int foo4() TESTCASE_THROW1(E2) { return 0; }
// all the STL exceptions...
void throw_bad_cast() throw(std::bad_cast) { throw std::bad_cast(); }
void throw_bad_exception() throw(std::bad_exception) { throw std::bad_exception(); }
void throw_domain_error() throw(std::domain_error) { throw std::domain_error("oops"); }
void throw_exception() throw(std::exception) { throw std::exception(); }
void throw_invalid_argument() throw(std::invalid_argument) { throw std::invalid_argument("oops"); }
void throw_length_error() throw(std::length_error) { throw std::length_error("oops"); }
void throw_logic_error() throw(std::logic_error) { throw std::logic_error("oops"); }
void throw_out_of_range() throw(std::out_of_range) { throw std::out_of_range("oops"); }
void throw_overflow_error() throw(std::overflow_error) { throw std::overflow_error("oops"); }
void throw_range_error() throw(std::range_error) { throw std::range_error("oops"); }
void throw_runtime_error() throw(std::runtime_error) { throw std::runtime_error("oops"); }
void throw_underflow_error() throw(std::underflow_error) { throw std::underflow_error("oops"); }
void throw_bad_cast() TESTCASE_THROW1(std::bad_cast) { throw std::bad_cast(); }
void throw_bad_exception() TESTCASE_THROW1(std::bad_exception) { throw std::bad_exception(); }
void throw_domain_error() TESTCASE_THROW1(std::domain_error) { throw std::domain_error("oops"); }
void throw_exception() TESTCASE_THROW1(std::exception) { throw std::exception(); }
void throw_invalid_argument() TESTCASE_THROW1(std::invalid_argument) { throw std::invalid_argument("oops"); }
void throw_length_error() TESTCASE_THROW1(std::length_error) { throw std::length_error("oops"); }
void throw_logic_error() TESTCASE_THROW1(std::logic_error) { throw std::logic_error("oops"); }
void throw_out_of_range() TESTCASE_THROW1(std::out_of_range) { throw std::out_of_range("oops"); }
void throw_overflow_error() TESTCASE_THROW1(std::overflow_error) { throw std::overflow_error("oops"); }
void throw_range_error() TESTCASE_THROW1(std::range_error) { throw std::range_error("oops"); }
void throw_runtime_error() TESTCASE_THROW1(std::runtime_error) { throw std::runtime_error("oops"); }
void throw_underflow_error() TESTCASE_THROW1(std::underflow_error) { throw std::underflow_error("oops"); }
};
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -5,27 +5,23 @@
* if there were also functions throwing 'std::logic_error' and
* 'std::exception' then the bug would not be fully replicated */
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW2(T1, T2)
%}
%{
#include <exception>
#include <stdexcept>
void test_domain_error() throw(std::domain_error)
void test_domain_error() TESTCASE_THROW2(std::domain_error, int)
{ throw std::domain_error("std::domain_error"); }
%}
%include <std_string.i>
#define SWIG_STD_EXCEPTIONS_AS_CLASSES
%include <std_except.i>
void test_domain_error() throw(std::domain_error)
void test_domain_error() TESTCASE_THROW2(std::domain_error, int)
{ throw std::domain_error("std::domain_error"); }
%inline %{
@ -36,11 +32,3 @@ bool is_python_builtin() { return false; }
#endif
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -6,17 +6,12 @@
%apply std::string& INOUT { std::string &inout }
#endif
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
%}
%inline %{
std::string test_value(std::string x) {
@ -59,28 +54,23 @@ void test_reference_inout(std::string &inout) {
inout += inout;
}
void test_throw() throw(std::string){
void test_throw() TESTCASE_THROW1(std::string){
static std::string x = "test_throw message";
throw x;
}
void test_const_reference_throw() throw(const std::string &){
void test_const_reference_throw() TESTCASE_THROW1(const std::string &){
static std::string x = "test_const_reference_throw message";
throw x;
}
void test_pointer_throw() throw(std::string *) {
void test_pointer_throw() TESTCASE_THROW1(std::string *) {
throw new std::string("foo");
}
void test_const_pointer_throw() throw(const std::string *) {
void test_const_pointer_throw() TESTCASE_THROW1(const std::string *) {
throw new std::string("foo");
}
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
%}
/* Old way, now std::string is a %naturalvar by default
@ -162,11 +152,3 @@ public:
}
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -3,6 +3,12 @@
%include <std_wstring.i>
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
%{
#define TESTCASE_THROW1(T1)
%}
%inline %{
struct A : std::wstring
@ -82,27 +88,12 @@ bool test_equal_abc(const std::wstring &s) {
return L"abc" == s;
}
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
void test_throw() throw(std::wstring){
void test_throw() TESTCASE_THROW1(std::wstring){
static std::wstring x = L"x";
throw x;
}
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else

View file

@ -65,7 +65,7 @@ CSRCS = octave_empty.c
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir) OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .m file

View file

@ -4,7 +4,7 @@ require "tests.php";
require "director_exception.php";
// No new functions
check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
// No new classes
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
// now new vars

View file

@ -4,7 +4,7 @@ require "tests.php";
require "director_exception.php";
// No new functions
check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
// No new classes
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
// now new vars

View file

@ -7,16 +7,6 @@
%rename(TestDir) TestDirector;
#endif
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
%}
// Ruby constant names
#pragma SWIG nowarn=SWIGWARN_RUBY_WRONG_NAME
@ -263,14 +253,17 @@ macro(Param<char>, pfx, paramc)
macro(size_t, pfx, sizet)
%enddef
%define catches_decl(type, pfx, name)
%catches(type) pfx##_##name(type x);
%enddef
/* function passing by value */
%define val_decl(type, pfx, name)
type pfx##_##name(type x) throw (type) { return x; }
type pfx##_##name(type x) { return x; }
%enddef
/* function passing by ref */
%define ref_decl(type, pfx, name)
const type& pfx##_##name(const type& x) throw (type) { return x; }
const type& pfx##_##name(const type& x) { return x; }
%enddef
/* C++ constant declaration */
@ -305,6 +298,11 @@ macro(size_t, pfx, sizet)
%test_prim_types(sct_decl, sct)
%test_prim_types(catches_decl, val)
%test_prim_types(catches_decl, ref)
%test_prim_types(catches_decl, cct)
%test_prim_types(catches_decl, var)
%inline {
%test_prim_types(val_decl, val)
%test_prim_types(ref_decl, ref)
@ -456,12 +454,12 @@ macro(size_t, pfx, sizet)
var_decl(namet, var, namet)
const char* val_namet(namet x) throw(namet)
const char* val_namet(namet x)
{
return x;
}
const char* val_cnamet(const namet x) throw(namet)
const char* val_cnamet(const namet x)
{
return x;
}
@ -469,7 +467,7 @@ macro(size_t, pfx, sizet)
#if 0
/* I have no idea how to define a typemap for
const namet&, where namet is a char[ANY] array */
const namet& ref_namet(const namet& x) throw(namet)
const namet& ref_namet(const namet& x)
{
return x;
}
@ -513,12 +511,12 @@ macro(size_t, pfx, sizet)
var_namet[0]='h';
}
virtual const char* vval_namet(namet x) throw(namet)
virtual const char* vval_namet(namet x)
{
return x;
}
virtual const char* vval_cnamet(const namet x) throw(namet)
virtual const char* vval_cnamet(const namet x)
{
return x;
}
@ -526,7 +524,7 @@ macro(size_t, pfx, sizet)
#if 0
/* I have no idea how to define a typemap for
const namet&, where namet is a char[ANY] array */
virtual const namet& vref_namet(const namet& x) throw(namet)
virtual const namet& vref_namet(const namet& x)
{
return x;
}
@ -563,7 +561,7 @@ macro(size_t, pfx, sizet)
%test_prim_types_ovr(ovr_decl, ovr)
virtual Test* vtest(Test* t) const throw (Test)
virtual Test* vtest(Test* t) const
{
return t;
}

View file

@ -11,7 +11,7 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
PYCODESTYLE = @PYCODESTYLE@
PYCODESTYLE_FLAGS = --ignore=E30,E402,E501,E731,W291,W391
PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
PY2SCRIPTSUFFIX = _runme.py

View file

@ -0,0 +1,18 @@
from cpp17_nested_namespaces import *
A1Struct().A1Method()
B1Struct().B1Method()
C1Struct().C1Method()
createA1Struct().A1Method()
createB1Struct().B1Method()
createC1Struct().C1Method()
B2Struct().B2Method()
C2Struct().C2Method()
createB2Struct().B2Method()
createC2Struct().C2Method()
B3Struct().B3Method()
C3Struct().C3Method()
createB3Struct().B3Method()
createC3Struct().C3Method()

View file

@ -2,14 +2,12 @@
%module python_builtin
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
#define TESTCASE_THROW2(T1, T2)
%}
%inline %{
@ -196,13 +194,13 @@ void Dealloc2Destroyer(PyObject *v) {
return size;
}
int __getitem__(Py_ssize_t n) throw (std::out_of_range) {
int __getitem__(Py_ssize_t n) TESTCASE_THROW1(std::out_of_range) {
if (n >= (int)size)
throw std::out_of_range("Index too large");
return numbers[n];
}
SimpleArray __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
SimpleArray __getitem__(PySliceObject *slice) TESTCASE_THROW2(std::out_of_range, std::invalid_argument) {
if (!PySlice_Check(slice))
throw std::invalid_argument("Slice object expected");
Py_ssize_t i, j, step;
@ -228,11 +226,3 @@ void Dealloc2Destroyer(PyObject *v) {
};
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -1,6 +1,10 @@
%module register_par
%{
struct swig_tree;
%}
// bug # 924413
%inline {
void clear_tree_flags(register struct tree *tp, register int i) {}
void clear_tree_flags(register struct swig_tree *tp, register int i) {}
}

View file

@ -22,6 +22,7 @@ CPP_TEST_CASES = \
li_std_stack \
li_std_wstring \
primitive_types \
ruby_alias_method \
ruby_keywords \
ruby_minherit_shared_ptr \
ruby_naming \
@ -44,6 +45,8 @@ CPP11_TEST_CASES = \
C_TEST_CASES += \
li_cstring \
ruby_alias_global_function \
ruby_alias_module_function \
ruby_manual_proxy \
include $(srcdir)/../common.mk
@ -52,6 +55,7 @@ include $(srcdir)/../common.mk
SWIGOPT += -w801 -noautorename -features autodoc=4
# Custom tests - tests with additional commandline options
ruby_alias_global_function.ctest: SWIGOPT += -globalmodule
ruby_naming.cpptest: SWIGOPT += -autorename
# Rules for the different types of tests

View file

@ -0,0 +1,20 @@
#!/usr/bin/env ruby
#
# Runtime tests for ruby_alias_global_function.i
#
require 'swig_assert'
require 'ruby_alias_global_function'
expected_name = get_my_name
swig_assert(fullname == expected_name, msg: "nickname not working as expected")
swig_assert(nickname == expected_name, msg: "fullname not working as expected")
if method(:nickname).respond_to?(:original_name)
swig_assert_equal_simple(method(:nickname).original_name, :get_my_name)
swig_assert_equal_simple(method(:fullname).original_name, :get_my_name)
else
swig_assert(method(:nickname) == method(:get_my_name), msg: "nickname is not an alias of get_my_name")
swig_assert(method(:fullname) == method(:get_my_name), msg: "fullname is not an alias of get_my_name")
end

View file

@ -0,0 +1,24 @@
#!/usr/bin/env ruby
#
# Runtime tests for ruby_alias_method.i
#
require 'swig_assert'
require 'ruby_alias_method'
include Ruby_alias_method
expected_name = "Chester Tester"
syn = Synonym.new(expected_name)
swig_assert(syn.getMyName() == expected_name, msg: "getMyName not working as expected")
swig_assert(syn.nickname() == expected_name, msg: "nickname not working as expected")
swig_assert(syn.fullname() == expected_name, msg: "fullname not working as expected")
if syn.method(:nickname).respond_to?(:original_name)
swig_assert_equal_simple(syn.method(:nickname).original_name, :getMyName)
swig_assert_equal_simple(syn.method(:fullname).original_name, :getMyName)
else
swig_assert(syn.method(:nickname) == syn.method(:getMyName))
swig_assert(syn.method(:fullname) == syn.method(:getMyName))
end

View file

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
#
# Runtime tests for ruby_alias_module_function.i
#
require 'swig_assert'
require 'ruby_alias_module_function'
include Ruby_alias_module_function
expected_name = Ruby_alias_module_function.get_my_name
swig_assert(Ruby_alias_module_function.nickname == expected_name, msg: "nickname returned a different result than get_my_name")
swig_assert(Ruby_alias_module_function.fullname == expected_name, msg: "fullname returned a different result than get_my_name")
nickname_method = Ruby_alias_module_function.method(:nickname)
fullname_method = Ruby_alias_module_function.method(:fullname)
if nickname_method.respond_to?(:original_name)
swig_assert_equal_simple(nickname_method.original_name, :get_my_name)
swig_assert_equal_simple(fullname_method.original_name, :get_my_name)
else
original_method = Ruby_alias_module_function.method(:get_my_name)
swig_assert(nickname_method == original_method, msg: "nickname is not an alias of get_my_name")
swig_assert(fullname_method == original_method, msg: "fullname is not an alias of get_my_name")
end

View file

@ -0,0 +1,11 @@
%module ruby_alias_global_function
%alias get_my_name "nickname,fullname";
%inline %{
const char *get_my_name(){
return "Chester Tester";
}
%}

View file

@ -0,0 +1,26 @@
%module ruby_alias_method
%include <std_string.i>
%alias Synonym::getMyName "nickname,fullname"
%inline %{
class Synonym {
private:
std::string myName;
public:
Synonym(std::string myName);
std::string getMyName();
};
Synonym::Synonym(std::string myName){
this->myName = myName;
};
std::string Synonym::getMyName(){
return this->myName;
};
%}

View file

@ -0,0 +1,11 @@
%module ruby_alias_module_function
%alias get_my_name "nickname,fullname";
%inline %{
const char *get_my_name(){
return "Chester Tester";
}
%}

View file

@ -4,6 +4,14 @@
%module(threads="1") threads_exception
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
#define TESTCASE_THROW1(T1)
#define TESTCASE_THROW3(T1, T2, T3)
%}
%{
struct A {};
%}
@ -11,14 +19,6 @@ struct A {};
%inline %{
#include <string>
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
class Exc {
public:
Exc(int c, const char *m) {
@ -32,24 +32,24 @@ public:
class Test {
public:
int simple() throw(int) {
int simple() TESTCASE_THROW1(int) {
throw(37);
return 1;
}
int message() throw(const char *) {
int message() TESTCASE_THROW1(const char *) {
throw("I died.");
return 1;
}
int hosed() throw(Exc) {
int hosed() TESTCASE_THROW1(Exc) {
throw(Exc(42,"Hosed"));
return 1;
}
int unknown() throw(A*) {
int unknown() TESTCASE_THROW1(A*) {
static A a;
throw &a;
return 1;
}
int multi(int x) throw(int, const char *, Exc) {
int multi(int x) TESTCASE_THROW3(int, const char *, Exc) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
@ -62,11 +62,4 @@ bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -1,13 +1,11 @@
%module throw_exception
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW1(T1) throw(T1)
#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW1(T1)
#define TESTCASE_THROW3(T1, T2, T3)
%}
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1;
@ -34,45 +32,45 @@ namespace Namespace {
}
class Foo {
public:
void test_int() throw(int) {
void test_int() TESTCASE_THROW1(int) {
throw 37;
}
void test_msg() throw(const char *) {
void test_msg() TESTCASE_THROW1(const char *) {
throw "Dead";
}
void test_cls() throw(CError) {
void test_cls() TESTCASE_THROW1(CError) {
throw CError();
}
void test_cls_ptr() throw(CError *) {
void test_cls_ptr() TESTCASE_THROW1(CError *) {
static CError StaticError;
throw &StaticError;
}
void test_cls_ref() throw(CError &) {
void test_cls_ref() TESTCASE_THROW1(CError &) {
static CError StaticError;
throw StaticError;
}
void test_cls_td() throw(Namespace::ErrorTypedef) {
void test_cls_td() TESTCASE_THROW1(Namespace::ErrorTypedef) {
throw CError();
}
void test_cls_ptr_td() throw(Namespace::ErrorPtr) {
void test_cls_ptr_td() TESTCASE_THROW1(Namespace::ErrorPtr) {
static CError StaticError;
throw &StaticError;
}
void test_cls_ref_td() throw(Namespace::ErrorRef) {
void test_cls_ref_td() TESTCASE_THROW1(Namespace::ErrorRef) {
static CError StaticError;
throw StaticError;
}
void test_array() throw(Namespace::IntArray) {
void test_array() TESTCASE_THROW1(Namespace::IntArray) {
static Namespace::IntArray array;
for (int i=0; i<10; i++) {
array[i] = i;
}
throw array;
}
void test_enum() throw(Namespace::EnumTest) {
void test_enum() TESTCASE_THROW1(Namespace::EnumTest) {
throw Namespace::enum2;
}
void test_multi(int x) throw(int, const char *, CError) {
void test_multi(int x) TESTCASE_THROW3(int, const char *, CError) {
if (x == 1) throw 37;
if (x == 2) throw "Dead";
if (x == 3) throw CError();
@ -81,11 +79,3 @@ public:
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}

View file

@ -4,14 +4,10 @@
%csmethodmodifiers x "public new"
#endif
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
#endif
#define TESTCASE_THROW2(T1, T2)
%}
%inline %{
@ -20,7 +16,7 @@
int x;
virtual ~Foo() { }
virtual Foo* blah() { return this; }
virtual Foo* exception_spec(int what_to_throw) throw (int, const char *) {
virtual Foo* exception_spec(int what_to_throw) TESTCASE_THROW2(int, const char *) {
int num = 10;
const char *str = "exception message";
if (what_to_throw == 1) throw num;
@ -38,11 +34,3 @@
%}
%{
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#if __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
%}