Skip to content

Commit

Permalink
fix: make uncaughtExceptions compilable with libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamStepan committed Jul 23, 2019
1 parent 79c7290 commit b734556
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/superior_mysqlpp/uncaught_exception_counter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ namespace SuperiorMySqlpp
{
inline int uncaughtExceptions() noexcept
{
// There is no `__cxa_get_clobals` in newer libc++ abi, so we are forced to use
// `__cxa_uncaught_exceptions`
#if defined(_LIBCPPABI_VERSION) && _LIBCPPABI_VERSION >= 1002
return static_cast<int>(__cxxabiv1::__cxa_uncaught_exceptions());
#else
auto* globalsPtr = __cxxabiv1::__cxa_get_globals();
auto* globalsEreasedPtr = reinterpret_cast<char*>(globalsPtr);
auto* uncaughtExceptionsErasedPtr = globalsEreasedPtr + sizeof(void*);
auto* uncaughtExceptionsPtr = reinterpret_cast<int*>(uncaughtExceptionsErasedPtr);
return *uncaughtExceptionsPtr;
#endif
}

class UncaughtExceptionCounter
Expand Down
3 changes: 3 additions & 0 deletions packages/_debian-common/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ libsuperiormysqlpp (0.5.1) UNRELEASED; urgency=medium
[ Radek Smejdir ]
* chore: Update bandit submodule to current HEAD

[ Adam Stepan ]
* fix: Make `uncaughtExceptions` compilable with libc++

-- Peter Opatril <[email protected]> Thu, 20 Jun 2019 13:10:51 +0000

libsuperiormysqlpp (0.5.0) unstable; urgency=medium
Expand Down

0 comments on commit b734556

Please sign in to comment.