2017-06-25 19:29:32 +02:00
|
|
|
#define _GLIBCXX_USE_CXX11_ABI 0
|
|
|
|
// include libstd++ specific header <bits/c++config.h> containing __GLIBCXX__
|
2017-06-01 11:29:33 +02:00
|
|
|
// without including ios already (must be included after setting _GLIBCXX_USE_CXX11_ABI)
|
2017-06-25 19:29:32 +02:00
|
|
|
#include <cstddef>
|
2017-06-01 11:29:33 +02:00
|
|
|
|
2017-01-19 21:57:55 +01:00
|
|
|
// ensure the old ABI is used under libstd++ < 7 and the new ABI under libstd++ >= 7
|
2017-06-25 19:29:32 +02:00
|
|
|
#if __GLIBCXX__ >= 20170502
|
|
|
|
#undef _GLIBCXX_USE_CXX11_ABI
|
2017-01-19 21:57:55 +01:00
|
|
|
#define _GLIBCXX_USE_CXX11_ABI 1
|
|
|
|
#endif
|
2016-08-29 15:35:48 +02:00
|
|
|
|
|
|
|
#include "./catchiofailure.h"
|
|
|
|
|
|
|
|
#include <ios>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace IoUtilities {
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Provides a workaround for GCC Bug 66145.
|
|
|
|
* \returns Returns the error message.
|
|
|
|
* \throws Throws the current exception if it is not std::ios_base::failure.
|
|
|
|
*/
|
|
|
|
const char *catchIoFailure()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
throw;
|
2017-05-01 03:13:11 +02:00
|
|
|
} catch (const ios_base::failure &e) {
|
2016-08-29 15:35:48 +02:00
|
|
|
return e.what();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Throws a std::ios_base::failure with the specified message.
|
|
|
|
*/
|
|
|
|
void throwIoFailure(const char *what)
|
|
|
|
{
|
|
|
|
throw ios_base::failure(what);
|
|
|
|
}
|
|
|
|
}
|