test-suite support for C++17: exception specification throw removal

This commit is contained in:
William S Fulton 2018-05-03 18:57:46 +01:00
commit 35b792daed
23 changed files with 190 additions and 419 deletions

View file

@ -12,14 +12,10 @@
%include "exception.i"
// throw is invalid in C++17 and later, only SWIG to use it
#define TESTCASE_THROW(TYPES...) throw(TYPES)
%{
#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_THROW(TYPES...)
%}
/*
@ -103,13 +99,13 @@
int efoovar;
/* caught by the user's throw definition */
int foo() throw(E1)
int foo() TESTCASE_THROW(E1)
{
throw E1();
return 0;
}
int bar() throw(E2)
int bar() TESTCASE_THROW(E2)
{
throw E2();
return 0;
@ -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
%}