Skip to content

Commit

Permalink
Fix compilation with libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamStepan committed Jun 25, 2019
1 parent e36187b commit 8fc5522
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
19 changes: 3 additions & 16 deletions include/superior_mysqlpp/uncaught_exception_counter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,19 @@

#pragma once

#include <cxxabi.h>
#include <exception>

namespace SuperiorMySqlpp
{
inline int uncaughtExceptions() noexcept
{
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;
}

class UncaughtExceptionCounter
{
private:
int exceptionCount;
std::exception_ptr oldException{std::current_exception()};

public:
UncaughtExceptionCounter() noexcept
: exceptionCount{uncaughtExceptions()}
{}

bool isNewUncaughtException() const noexcept
{
return uncaughtExceptions() > exceptionCount;
return std::current_exception() != oldException;
}
};
}
5 changes: 3 additions & 2 deletions packages/_debian-common/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
libsuperiormysqlpp (0.5.1) UNRELEASED; urgency=medium

*
[ Adam Stepan ]
* Fix compilation with libc++

-- Peter Opatril <petr.opatril@firma.seznam.cz> Thu, 20 Jun 2019 13:10:51 +0000
-- Adam Stepan <adam.stepan@firma.seznam.cz> Tue, 25 Jun 2019 15:10:11 +0200

libsuperiormysqlpp (0.5.0) unstable; urgency=medium

Expand Down

0 comments on commit 8fc5522

Please sign in to comment.