From 5c1c69d14040bc5e04d4682f43ceeb45af93e1ca Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 7 Jun 2019 19:55:15 +0100 Subject: Replace std::unexpected_handler with std::terminate_handler to be c++17 compliant Closes #1538 --- Lib/python/director.swg | 11 +++++------ Lib/ruby/director.swg | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 4bdc94dc2..36df302f1 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -219,7 +219,7 @@ namespace Swig { PyErr_Print(); std::cerr << std::endl; - std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl + std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl << std::endl << "Exception is being re-thrown, program will likely abort/terminate." << std::endl; @@ -227,14 +227,13 @@ namespace Swig { } public: - - std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) { - old = std::set_unexpected(nh); + std::terminate_handler old; + UnknownExceptionHandler(std::terminate_handler nh = handler) { + old = std::set_terminate(nh); } ~UnknownExceptionHandler() { - std::set_unexpected(old); + std::set_terminate(old); } #endif }; diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg index c6c53a343..a0569785f 100644 --- a/Lib/ruby/director.swg +++ b/Lib/ruby/director.swg @@ -170,7 +170,7 @@ namespace Swig { std::cerr << std::endl << "Ruby interpreter traceback:" << std::endl; std::cerr << std::endl; - std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl + std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl << std::endl << "Exception is being re-thrown, program will like abort/terminate." << std::endl; @@ -178,13 +178,13 @@ namespace Swig { } public: - std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) { - old = std::set_unexpected(nh); + std::terminate_handler old; + UnknownExceptionHandler(std::terminate_handler nh = handler) { + old = std::set_terminate(nh); } ~UnknownExceptionHandler() { - std::set_unexpected(old); + std::set_terminate(old); } #endif }; -- cgit v1.2.1