mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
More simple [#CLICKHOUSE-3989]
This commit is contained in:
parent
3342b422a3
commit
dbf3ccdcb8
@ -22,7 +22,6 @@ musl/exp2f.c)
|
||||
if (MAKE_STATIC_LIBRARIES)
|
||||
set (GLIBC_COMPATIBILITY_SOURCES ${GLIBC_COMPATIBILITY_SOURCES}
|
||||
libcxxabi/cxa_thread_atexit.cpp
|
||||
libcxxabi/abort_message.cpp
|
||||
libcxxabi/cxa_thread_atexit_impl.c)
|
||||
endif ()
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,73 +0,0 @@
|
||||
//===-------------------------- __cxxabi_config.h -------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef ____CXXABI_CONFIG_H
|
||||
#define ____CXXABI_CONFIG_H
|
||||
|
||||
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
|
||||
!defined(__ARM_DWARF_EH__)
|
||||
#define _LIBCXXABI_ARM_EHABI
|
||||
#endif
|
||||
|
||||
#if !defined(__has_attribute)
|
||||
#define __has_attribute(_attribute_) 0
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCXXABI_HIDDEN
|
||||
#define _LIBCXXABI_DATA_VIS
|
||||
#define _LIBCXXABI_FUNC_VIS
|
||||
#define _LIBCXXABI_TYPE_VIS
|
||||
#elif defined(_LIBCXXABI_BUILDING_LIBRARY)
|
||||
#define _LIBCXXABI_HIDDEN
|
||||
#define _LIBCXXABI_DATA_VIS __declspec(dllexport)
|
||||
#define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
|
||||
#define _LIBCXXABI_TYPE_VIS __declspec(dllexport)
|
||||
#else
|
||||
#define _LIBCXXABI_HIDDEN
|
||||
#define _LIBCXXABI_DATA_VIS __declspec(dllimport)
|
||||
#define _LIBCXXABI_FUNC_VIS __declspec(dllimport)
|
||||
#define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
|
||||
#define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
|
||||
#define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
|
||||
#if __has_attribute(__type_visibility__)
|
||||
#define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
|
||||
#else
|
||||
#define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
|
||||
#endif
|
||||
#else
|
||||
#define _LIBCXXABI_HIDDEN
|
||||
#define _LIBCXXABI_DATA_VIS
|
||||
#define _LIBCXXABI_FUNC_VIS
|
||||
#define _LIBCXXABI_TYPE_VIS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define _LIBCXXABI_WEAK
|
||||
#else
|
||||
#define _LIBCXXABI_WEAK __attribute__((__weak__))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCXXABI_COMPILER_CLANG
|
||||
#endif
|
||||
|
||||
#if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG)
|
||||
#define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi")))
|
||||
#else
|
||||
#define _LIBCXXABI_NO_CFI
|
||||
#endif
|
||||
|
||||
#endif // ____CXXABI_CONFIG_H
|
@ -1,402 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_THREADING_SUPPORT
|
||||
#define _LIBCPP_THREADING_SUPPORT
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# include <__external_threading>
|
||||
#elif !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
|
||||
#else
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(no_thread_safety_analysis)
|
||||
#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis))
|
||||
#else
|
||||
#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
// Mutex
|
||||
typedef pthread_mutex_t __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
typedef pthread_mutex_t __libcpp_recursive_mutex_t;
|
||||
|
||||
// Condition Variable
|
||||
typedef pthread_cond_t __libcpp_condvar_t;
|
||||
#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
|
||||
|
||||
// Execute once
|
||||
typedef pthread_once_t __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
|
||||
|
||||
// Thread id
|
||||
typedef pthread_t __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thrad Local Storage
|
||||
typedef pthread_key_t __libcpp_tls_key;
|
||||
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC
|
||||
#else
|
||||
// Mutex
|
||||
typedef void* __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER 0
|
||||
|
||||
#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
|
||||
typedef void* __libcpp_recursive_mutex_t[6];
|
||||
#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
|
||||
typedef void* __libcpp_recursive_mutex_t[5];
|
||||
#else
|
||||
# error Unsupported architecture
|
||||
#endif
|
||||
|
||||
// Condition Variable
|
||||
typedef void* __libcpp_condvar_t;
|
||||
#define _LIBCPP_CONDVAR_INITIALIZER 0
|
||||
|
||||
// Execute Once
|
||||
typedef void* __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER 0
|
||||
|
||||
// Thread ID
|
||||
typedef long __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef void* __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
typedef long __libcpp_tls_key;
|
||||
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
|
||||
#endif
|
||||
|
||||
// Mutex
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_mutex_destroy(__libcpp_mutex_t *__m);
|
||||
|
||||
// Condition variable
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
||||
timespec *__ts);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
|
||||
|
||||
// Execute once
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
void (*init_routine)(void));
|
||||
|
||||
// Thread id
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
// Thread
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id();
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_yield();
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
|
||||
|
||||
// Thread local storage
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void *__libcpp_tls_get(__libcpp_tls_key __key);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
|
||||
|
||||
#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \
|
||||
defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
int __ec = pthread_mutexattr_init(&attr);
|
||||
if (__ec)
|
||||
return __ec;
|
||||
__ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
if (__ec) {
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
return __ec;
|
||||
}
|
||||
__ec = pthread_mutex_init(__m, &attr);
|
||||
if (__ec) {
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
return __ec;
|
||||
}
|
||||
__ec = pthread_mutexattr_destroy(&attr);
|
||||
if (__ec) {
|
||||
pthread_mutex_destroy(__m);
|
||||
return __ec;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_unlock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_destroy(__m);
|
||||
}
|
||||
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_unlock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_destroy(__m);
|
||||
}
|
||||
|
||||
// Condition Variable
|
||||
int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
return pthread_cond_signal(__cv);
|
||||
}
|
||||
|
||||
int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
return pthread_cond_broadcast(__cv);
|
||||
}
|
||||
|
||||
int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_cond_wait(__cv, __m);
|
||||
}
|
||||
|
||||
int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
||||
timespec *__ts)
|
||||
{
|
||||
return pthread_cond_timedwait(__cv, __m, __ts);
|
||||
}
|
||||
|
||||
int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
return pthread_cond_destroy(__cv);
|
||||
}
|
||||
|
||||
// Execute once
|
||||
int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
void (*init_routine)(void)) {
|
||||
return pthread_once(flag, init_routine);
|
||||
}
|
||||
|
||||
// Thread id
|
||||
// Returns non-zero if the thread ids are equal, otherwise 0
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
return pthread_equal(t1, t2) != 0;
|
||||
}
|
||||
|
||||
// Returns non-zero if t1 < t2, otherwise 0
|
||||
bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
return t1 < t2;
|
||||
}
|
||||
|
||||
// Thread
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
return pthread_create(__t, 0, __func, __arg);
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id()
|
||||
{
|
||||
return pthread_self();
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
|
||||
{
|
||||
return *__t;
|
||||
}
|
||||
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t)
|
||||
{
|
||||
return pthread_join(*__t, 0);
|
||||
}
|
||||
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t)
|
||||
{
|
||||
return pthread_detach(*__t);
|
||||
}
|
||||
|
||||
void __libcpp_thread_yield()
|
||||
{
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
seconds __s = duration_cast<seconds>(__ns);
|
||||
timespec __ts;
|
||||
typedef decltype(__ts.tv_sec) ts_sec;
|
||||
_LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
|
||||
|
||||
if (__s.count() < __ts_sec_max)
|
||||
{
|
||||
__ts.tv_sec = static_cast<ts_sec>(__s.count());
|
||||
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
|
||||
}
|
||||
else
|
||||
{
|
||||
__ts.tv_sec = __ts_sec_max;
|
||||
__ts.tv_nsec = 999999999; // (10^9 - 1)
|
||||
}
|
||||
|
||||
while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
// Thread local storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
|
||||
{
|
||||
return pthread_key_create(__key, __at_exit);
|
||||
}
|
||||
|
||||
void *__libcpp_tls_get(__libcpp_tls_key __key)
|
||||
{
|
||||
return pthread_getspecific(__key);
|
||||
}
|
||||
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
||||
{
|
||||
return pthread_setspecific(__key, __p);
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_THREADING_SUPPORT
|
@ -1,34 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------ __undef_macros ------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifdef min
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing min")
|
||||
#else
|
||||
#warning: macro min is incompatible with C++. #undefing min
|
||||
#endif
|
||||
#endif
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing max")
|
||||
#else
|
||||
#warning: macro max is incompatible with C++. #undefing max
|
||||
#endif
|
||||
#endif
|
||||
#undef max
|
||||
#endif
|
@ -1,78 +0,0 @@
|
||||
//===------------------------- abort_message.cpp --------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "abort_message.h"
|
||||
|
||||
#ifdef __BIONIC__
|
||||
#include <android/api-level.h>
|
||||
#if __ANDROID_API__ >= 21
|
||||
#include <syslog.h>
|
||||
extern "C" void android_set_abort_message(const char* msg);
|
||||
#else
|
||||
#include <assert.h>
|
||||
#endif // __ANDROID_API__ >= 21
|
||||
#endif // __BIONIC__
|
||||
|
||||
#ifdef __APPLE__
|
||||
# if defined(__has_include) && __has_include(<CrashReporterClient.h>)
|
||||
# define HAVE_CRASHREPORTERCLIENT_H
|
||||
# include <CrashReporterClient.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void abort_message(const char* format, ...)
|
||||
{
|
||||
// write message to stderr
|
||||
#if !defined(NDEBUG) || !defined(LIBCXXABI_BAREMETAL)
|
||||
#ifdef __APPLE__
|
||||
fprintf(stderr, "libc++abi.dylib: ");
|
||||
#endif
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
vfprintf(stderr, format, list);
|
||||
va_end(list);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_CRASHREPORTERCLIENT_H)
|
||||
// record message in crash report
|
||||
char* buffer;
|
||||
va_list list2;
|
||||
va_start(list2, format);
|
||||
vasprintf(&buffer, format, list2);
|
||||
va_end(list2);
|
||||
CRSetCrashLogMessage(buffer);
|
||||
#elif defined(__BIONIC__)
|
||||
char* buffer;
|
||||
va_list list2;
|
||||
va_start(list2, format);
|
||||
vasprintf(&buffer, format, list2);
|
||||
va_end(list2);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
// Show error in tombstone.
|
||||
android_set_abort_message(buffer);
|
||||
|
||||
// Show error in logcat.
|
||||
openlog("libc++abi", 0, 0);
|
||||
syslog(LOG_CRIT, "%s", buffer);
|
||||
closelog();
|
||||
#else
|
||||
// The good error reporting wasn't available in Android until L. Since we're
|
||||
// about to abort anyway, just call __assert2, which will log _somewhere_
|
||||
// (tombstone and/or logcat) in older releases.
|
||||
__assert2(__FILE__, __LINE__, __func__, buffer);
|
||||
#endif // __ANDROID_API__ >= 21
|
||||
#endif // __BIONIC__
|
||||
|
||||
abort();
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
//===-------------------------- abort_message.h-----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __ABORT_MESSAGE_H_
|
||||
#define __ABORT_MESSAGE_H_
|
||||
|
||||
#include "cxxabi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
|
||||
abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -7,10 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "abort_message.h"
|
||||
#include "cxxabi.h"
|
||||
#include <__threading_support>
|
||||
#include <cstdlib>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace __cxxabiv1 {
|
||||
|
||||
@ -56,7 +54,7 @@ namespace {
|
||||
// True if the destructors are currently scheduled to run on this thread
|
||||
__thread bool dtors_alive = false;
|
||||
// Used to trigger destructors on thread exit; value is ignored
|
||||
std::__libcpp_tls_key dtors_key;
|
||||
pthread_key_t dtors_key;
|
||||
|
||||
void run_dtors(void*) {
|
||||
while (auto head = dtors) {
|
||||
@ -73,8 +71,8 @@ namespace {
|
||||
// There is intentionally no matching std::__libcpp_tls_delete call, as
|
||||
// __cxa_thread_atexit() may be called arbitrarily late (for example, from
|
||||
// global destructors or atexit() handlers).
|
||||
if (std::__libcpp_tls_create(&dtors_key, run_dtors) != 0) {
|
||||
abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()");
|
||||
if (pthread_key_create(&dtors_key, run_dtors) != 0) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,13 +90,13 @@ namespace {
|
||||
|
||||
extern "C" {
|
||||
|
||||
_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
|
||||
int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
|
||||
// Initialize the dtors std::__libcpp_tls_key (uses __cxa_guard_*() for
|
||||
// one-time initialization and __cxa_atexit() for destruction)
|
||||
static DtorsManager manager;
|
||||
|
||||
if (!dtors_alive) {
|
||||
if (std::__libcpp_tls_set(dtors_key, &dtors_key) != 0) {
|
||||
if (pthread_setspecific(dtors_key, &dtors_key) != 0) {
|
||||
return -1;
|
||||
}
|
||||
dtors_alive = true;
|
||||
|
@ -1,177 +0,0 @@
|
||||
//===--------------------------- cxxabi.h ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CXXABI_H
|
||||
#define __CXXABI_H
|
||||
|
||||
/*
|
||||
* This header provides the interface to the C++ ABI as defined at:
|
||||
* http://www.codesourcery.com/cxx-abi/
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <__cxxabi_config.h>
|
||||
|
||||
#define _LIBCPPABI_VERSION 1002
|
||||
#define _LIBCXXABI_NORETURN __attribute__((noreturn))
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace std {
|
||||
#if defined(_WIN32)
|
||||
class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
|
||||
#else
|
||||
class type_info; // forward declaration
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
|
||||
namespace __cxxabiv1 {
|
||||
extern "C" {
|
||||
|
||||
// 2.4.2 Allocating the Exception Object
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_allocate_exception(size_t thrown_size) throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_free_exception(void *thrown_exception) throw();
|
||||
|
||||
// 2.4.3 Throwing the Exception Object
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
|
||||
__cxa_throw(void *thrown_exception, std::type_info *tinfo,
|
||||
void (*dest)(void *));
|
||||
|
||||
// 2.5.3 Exception Handlers
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_get_exception_ptr(void *exceptionObject) throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_begin_catch(void *exceptionObject) throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch();
|
||||
#if defined(_LIBCXXABI_ARM_EHABI)
|
||||
extern _LIBCXXABI_FUNC_VIS bool
|
||||
__cxa_begin_cleanup(void *exceptionObject) throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup();
|
||||
#endif
|
||||
extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
|
||||
|
||||
// 2.5.4 Rethrowing Exceptions
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow();
|
||||
|
||||
// 2.6 Auxiliary Runtime APIs
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void);
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
|
||||
__cxa_throw_bad_array_new_length(void);
|
||||
|
||||
// 3.2.6 Pure Virtual Function API
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
|
||||
|
||||
// 3.2.7 Deleted Virtual Function API
|
||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
|
||||
|
||||
// 3.3.2 One-time Construction API
|
||||
#ifdef __arm__
|
||||
extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint32_t *);
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint32_t *);
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint32_t *);
|
||||
#else
|
||||
extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint64_t *);
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint64_t *);
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint64_t *);
|
||||
#endif
|
||||
|
||||
// 3.3.3 Array Construction and Destruction API
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size,
|
||||
void (*constructor)(void *), void (*destructor)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size,
|
||||
void (*constructor)(void *), void (*destructor)(void *),
|
||||
void *(*alloc)(size_t), void (*dealloc)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void *
|
||||
__cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size,
|
||||
void (*constructor)(void *), void (*destructor)(void *),
|
||||
void *(*alloc)(size_t), void (*dealloc)(void *, size_t));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size,
|
||||
void (*constructor)(void *), void (*destructor)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address,
|
||||
size_t element_count,
|
||||
size_t element_size,
|
||||
void (*destructor)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address,
|
||||
size_t element_count,
|
||||
size_t element_size,
|
||||
void (*destructor)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete(void *array_address,
|
||||
size_t element_size,
|
||||
size_t padding_size,
|
||||
void (*destructor)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size,
|
||||
void (*destructor)(void *), void (*dealloc)(void *));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_vec_delete3(void *__array_address, size_t element_size,
|
||||
size_t padding_size, void (*destructor)(void *),
|
||||
void (*dealloc)(void *, size_t));
|
||||
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_vec_cctor(void *dest_array, void *src_array, size_t element_count,
|
||||
size_t element_size, void (*constructor)(void *, void *),
|
||||
void (*destructor)(void *));
|
||||
|
||||
// 3.3.5.3 Runtime API
|
||||
extern _LIBCXXABI_FUNC_VIS int __cxa_atexit(void (*f)(void *), void *p,
|
||||
void *d);
|
||||
extern _LIBCXXABI_FUNC_VIS int __cxa_finalize(void *);
|
||||
|
||||
// 3.4 Demangler API
|
||||
extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle(const char *mangled_name,
|
||||
char *output_buffer,
|
||||
size_t *length, int *status);
|
||||
|
||||
// Apple additions to support C++ 0x exception_ptr class
|
||||
// These are primitives to wrap a smart pointer around an exception object
|
||||
extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_rethrow_primary_exception(void *primary_exception);
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_increment_exception_refcount(void *primary_exception) throw();
|
||||
extern _LIBCXXABI_FUNC_VIS void
|
||||
__cxa_decrement_exception_refcount(void *primary_exception) throw();
|
||||
|
||||
// Apple extension to support std::uncaught_exception()
|
||||
extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw();
|
||||
extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw();
|
||||
|
||||
#ifdef __linux__
|
||||
// Linux TLS support. Not yet an official part of the Itanium ABI.
|
||||
// https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
|
||||
extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *,
|
||||
void *) throw();
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
} // namespace __cxxabiv1
|
||||
|
||||
namespace abi = __cxxabiv1;
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __CXXABI_H
|
Loading…
Reference in New Issue
Block a user