Move the libstdc++ code path to a separate file.
We need to #include <exception> for this to work, but this brings in the public definition of `std::type_info` and, unfortunately, that breaks the private definition that we need in this compilation unit.main
parent
55a4719976
commit
55819ce107
@ -0,0 +1,19 @@
|
||||
#include "visibility.h"
|
||||
#include <exception>
|
||||
|
||||
#ifdef __GLIBCXX__
|
||||
/**
|
||||
* libsupc++ doesn't expose __cxa_current_primary_exception, so implement this
|
||||
* using the libstdc++ wrapper. The exception pointer in the
|
||||
* `std::exception_ptr` object is reference counted, so stealing it by poking
|
||||
* at the pointer directly means that we acquire it with a reference count of
|
||||
* 1.
|
||||
*/
|
||||
PRIVATE extern "C" void *__cxa_current_primary_exception()
|
||||
{
|
||||
std::exception_ptr p = std::current_exception();
|
||||
void *obj = *(void**)&p;
|
||||
*(void**)&p = nullptr;
|
||||
return obj;
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in New Issue