Index: libopenmpt/dox/changelog.md =================================================================== --- libopenmpt/dox/changelog.md (revision 6617) +++ libopenmpt/dox/changelog.md (working copy) @@ -9,6 +9,11 @@ * [**Change**] libopenmpt now uses C++14 `[[deprecated]]` attribute instead of compiler-specific solutions when appropriate. + * [**Change**] libopenmpt C++ header now uses C++11 `noexcept` instead of + C++98 `throw()` exception specification when supported. `throw()` is + deprecated since C++11. This does not change API or ABI as they are + equivalent. Use `LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT` to override the + default. * The public libopenmpt C++ header has auto-detection logics for the used C++ standard now. I case your client code compiler misreports the standard Index: libopenmpt/libopenmpt.hpp =================================================================== --- libopenmpt/libopenmpt.hpp (revision 6617) +++ libopenmpt/libopenmpt.hpp (working copy) @@ -130,9 +130,9 @@ private: char * text; public: - exception( const std::string & text ) throw(); - virtual ~exception() throw(); - virtual const char * what() const throw(); + exception( const std::string & text ) LIBOPENMPT_NOEXCEPT; + virtual ~exception() LIBOPENMPT_NOEXCEPT; + virtual const char * what() const LIBOPENMPT_NOEXCEPT; }; // class exception //! Get the libopenmpt version number Index: libopenmpt/libopenmpt_config.h =================================================================== --- libopenmpt/libopenmpt_config.h (revision 6617) +++ libopenmpt/libopenmpt_config.h (working copy) @@ -112,11 +112,18 @@ /* handle known broken compilers here by defining LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED appropriately */ #endif +#ifndef LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT +/* handle known broken compilers here by defining LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT appropriately */ +#endif + #if defined(LIBOPENMPT_ASSUME_CPLUSPLUS) #ifndef LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED #define LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED LIBOPENMPT_ASSUME_CPLUSPLUS #endif +#ifndef LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT +#define LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT LIBOPENMPT_ASSUME_CPLUSPLUS #endif +#endif #endif @@ -212,6 +219,20 @@ #endif #endif +#ifdef __cplusplus +#if defined(LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT) +#if (LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT >= 201103L) +#define LIBOPENMPT_NOEXCEPT noexcept +#else +#define LIBOPENMPT_NOEXCEPT throw() +#endif +#elif (__cplusplus >= 201103L) +#define LIBOPENMPT_NOEXCEPT noexcept +#else +#define LIBOPENMPT_NOEXCEPT throw() +#endif +#endif + #include "libopenmpt_version.h" #endif /* LIBOPENMPT_CONFIG_H */ Index: libopenmpt/libopenmpt_cxx.cpp =================================================================== --- libopenmpt/libopenmpt_cxx.cpp (revision 6617) +++ libopenmpt/libopenmpt_cxx.cpp (working copy) @@ -21,7 +21,7 @@ namespace openmpt { -exception::exception( const std::string & text ) throw() +exception::exception( const std::string & text ) LIBOPENMPT_NOEXCEPT : std::exception() , text(0) { @@ -31,7 +31,7 @@ } } -exception::~exception() throw() { +exception::~exception() LIBOPENMPT_NOEXCEPT { if ( text ) { std::free( text ); text = 0; @@ -38,7 +38,7 @@ } } -const char * exception::what() const throw() { +const char * exception::what() const LIBOPENMPT_NOEXCEPT { if ( text ) { return text; } else {