Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with libc++ #112

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
AdamStepan marked this conversation as resolved.
Show resolved Hide resolved
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 <petr.opatril@firma.seznam.cz> Thu, 20 Jun 2019 13:10:51 +0000

libsuperiormysqlpp (0.5.0) unstable; urgency=medium
Expand Down