test-suite fixes (2) for compilers that don't support varargs
Split director_exception testcase into two so that testing throw(), with no arguments, that is nothrows, can be tested separately to throw() taking arguments. [The throw keyword needs to be removed for C++ compilation in C++11 and later when it was deprecated.]
This commit is contained in:
parent
9fb996b83f
commit
50cb18087d
5 changed files with 35 additions and 7 deletions
|
|
@ -183,6 +183,7 @@ CPP_TEST_CASES += \
|
||||||
director_enum \
|
director_enum \
|
||||||
director_exception \
|
director_exception \
|
||||||
director_exception_catches \
|
director_exception_catches \
|
||||||
|
director_exception_nothrow \
|
||||||
director_extend \
|
director_extend \
|
||||||
director_finalizer \
|
director_finalizer \
|
||||||
director_frob \
|
director_frob \
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@ Foo *launder(Foo *f) {
|
||||||
%{
|
%{
|
||||||
// throw is deprecated in C++11 and invalid in C++17 and later
|
// throw is deprecated in C++11 and invalid in C++17 and later
|
||||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||||
#define throw(TYPES...)
|
#define throw(TYPE1, TYPE2, TYPE3)
|
||||||
#else
|
#else
|
||||||
#define throw(TYPES...) throw(TYPES)
|
#define throw(TYPE1, TYPE2, TYPE3) throw(TYPE1, TYPE2, TYPE3)
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -139,16 +139,15 @@ Foo *launder(Foo *f) {
|
||||||
class Base
|
class Base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Base() throw() {}
|
virtual ~Base() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Bar : public Base
|
class Bar : public Base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string ping() throw(Exception1, Exception2&) { return "Bar::ping()"; }
|
virtual std::string ping() throw(Exception1, Exception2&, double) { return "Bar::ping()"; }
|
||||||
virtual std::string pong() throw(Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
|
virtual std::string pong() throw(Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
|
||||||
virtual std::string pang() throw() { return "Bar::pang()"; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Class to allow regression testing SWIG/PHP not checking if an exception
|
// Class to allow regression testing SWIG/PHP not checking if an exception
|
||||||
|
|
|
||||||
28
Examples/test-suite/director_exception_nothrow.i
Normal file
28
Examples/test-suite/director_exception_nothrow.i
Normal 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()"; }
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
@ -4,7 +4,7 @@ require "tests.php";
|
||||||
require "director_exception.php";
|
require "director_exception.php";
|
||||||
|
|
||||||
// No new functions
|
// 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
|
// No new classes
|
||||||
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
|
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
|
||||||
// now new vars
|
// now new vars
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ require "tests.php";
|
||||||
require "director_exception.php";
|
require "director_exception.php";
|
||||||
|
|
||||||
// No new functions
|
// 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
|
// No new classes
|
||||||
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
|
check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
|
||||||
// now new vars
|
// now new vars
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue