summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/config-ix.cmake1
-rw-r--r--include/cxxabi.h2
-rw-r--r--include/libunwind.h10
-rw-r--r--include/unwind.h8
-rw-r--r--src/Unwind/AddressSpace.hpp22
-rw-r--r--src/Unwind/UnwindCursor.hpp16
-rw-r--r--src/Unwind/UnwindRegistersRestore.S2
-rw-r--r--src/Unwind/UnwindRegistersSave.S2
-rw-r--r--src/Unwind/config.h19
-rw-r--r--src/Unwind/libunwind.cpp12
-rw-r--r--src/abort_message.cpp8
-rw-r--r--src/cxa_exception.cpp6
-rw-r--r--src/cxa_guard.cpp2
-rw-r--r--src/cxa_personality.cpp14
-rw-r--r--src/private_typeinfo.cpp8
16 files changed, 71 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0551200..a4a52bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,6 +221,7 @@ append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WSTRICT_OVERFLOW_FLAG -Wstrict-o
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WUNUSED_PARAMETER_FLAG -Wunused-parameter)
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WUNUSED_VARIABLE_FLAG -Wunused-variable)
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WUNDEF_FLAG -Wundef)
if (LIBCXXABI_ENABLE_WERROR)
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror)
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index b6ee40f..2fea2cd 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -25,6 +25,7 @@ check_cxx_compiler_flag(-Wsign-compare LIBCXXABI_HAS_WSIGN_COMPARE_FLAG)
check_cxx_compiler_flag(-Wshadow LIBCXXABI_HAS_WSHADOW_FLAG)
check_cxx_compiler_flag(-Wconversion LIBCXXABI_HAS_WCONVERSION_FLAG)
check_cxx_compiler_flag(-Wnewline-eof LIBCXXABI_HAS_WNEWLINE_EOF_FLAG)
+check_cxx_compiler_flag(-Wundef LIBCXXABI_HAS_WUNDEF_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXXABI_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXXABI_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-Wno-error LIBCXXABI_HAS_WNO_ERROR_FLAG)
diff --git a/include/cxxabi.h b/include/cxxabi.h
index 2614327..ae75f86 100644
--- a/include/cxxabi.h
+++ b/include/cxxabi.h
@@ -77,7 +77,7 @@ extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
// 3.3.2 One-time Construction API
-#if __arm__
+#ifdef __arm__
extern int __cxa_guard_acquire(uint32_t*);
extern void __cxa_guard_release(uint32_t*);
extern void __cxa_guard_abort(uint32_t*);
diff --git a/include/libunwind.h b/include/libunwind.h
index 448d86a..9c69551 100644
--- a/include/libunwind.h
+++ b/include/libunwind.h
@@ -25,9 +25,9 @@
#define LIBCXXABI_ARM_EHABI 0
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <Availability.h>
- #if __arm__
+ #ifdef __arm__
#define LIBUNWIND_AVAIL __attribute__((unavailable))
#else
#define LIBUNWIND_AVAIL __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0)
@@ -100,7 +100,7 @@ extern int unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t) LIBUNWIND_AVAIL
extern int unw_set_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t) LIBUNWIND_AVAIL;
extern int unw_resume(unw_cursor_t *) LIBUNWIND_AVAIL;
-#if __arm__
+#ifdef __arm__
/* Save VFP registers in FSTMX format (instead of FSTMD). */
extern void unw_save_vfp_as_X(unw_cursor_t *) LIBUNWIND_AVAIL;
#endif
@@ -113,7 +113,7 @@ extern int unw_is_signal_frame(unw_cursor_t *) LIBUNWIND_AVAIL;
extern int unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *) LIBUNWIND_AVAIL;
//extern int unw_get_save_loc(unw_cursor_t*, int, unw_save_loc_t*);
-#if UNW_REMOTE
+#ifdef UNW_REMOTE
/*
* Mac OS X "remote" API for unwinding other processes on same machine
*
@@ -122,7 +122,7 @@ extern unw_addr_space_t unw_local_addr_space;
extern unw_addr_space_t unw_create_addr_space_for_task(task_t);
extern void unw_destroy_addr_space(unw_addr_space_t);
extern int unw_init_remote_thread(unw_cursor_t *, unw_addr_space_t, thread_t *);
-#endif
+#endif /* UNW_REMOTE */
/*
* traditional libuwind "remote" API
diff --git a/include/unwind.h b/include/unwind.h
index 02cda67..52e6304 100644
--- a/include/unwind.h
+++ b/include/unwind.h
@@ -159,7 +159,7 @@ extern "C" {
//
// The following are the base functions documented by the C++ ABI
//
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
extern _Unwind_Reason_Code
_Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object);
extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object);
@@ -245,7 +245,7 @@ extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);
extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
extern uintptr_t
_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
extern _Unwind_Reason_Code
_Unwind_SjLj_ForcedUnwind(_Unwind_Exception *exception_object,
_Unwind_Stop_Fn stop, void *stop_parameter);
@@ -255,7 +255,7 @@ extern _Unwind_Reason_Code
_Unwind_Stop_Fn stop, void *stop_parameter);
#endif
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t;
extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc);
extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc);
@@ -268,7 +268,7 @@ extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc);
//
// called by __cxa_rethrow().
//
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
extern _Unwind_Reason_Code
_Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *exception_object);
#else
diff --git a/src/Unwind/AddressSpace.hpp b/src/Unwind/AddressSpace.hpp
index 4e94afc..56e76bc 100644
--- a/src/Unwind/AddressSpace.hpp
+++ b/src/Unwind/AddressSpace.hpp
@@ -18,11 +18,11 @@
#include <stdlib.h>
#include <string.h>
-#if !_LIBUNWIND_IS_BAREMETAL
+#ifndef _LIBUNWIND_IS_BAREMETAL
#include <dlfcn.h>
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <mach-o/getsect.h>
namespace libunwind {
bool checkKeyMgrRegisteredFDEs(uintptr_t targetAddr, void *&fde);
@@ -43,9 +43,9 @@ extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len);
// Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system.
#define dl_unwind_find_exidx __gnu_Unwind_Find_exidx
-#elif !_LIBUNWIND_IS_BAREMETAL
+#elif !defined(_LIBUNWIND_IS_BAREMETAL)
#include <link.h>
-#else // _LIBUNWIND_IS_BAREMETAL
+#else // !defined(_LIBUNWIND_IS_BAREMETAL)
// When statically linked on bare-metal, the symbols for the EH table are looked
// up without going through the dynamic loader.
struct EHTEntry {
@@ -54,7 +54,7 @@ struct EHTEntry {
};
extern EHTEntry __exidx_start;
extern EHTEntry __exidx_end;
-#endif // !_LIBUNWIND_IS_BAREMETAL
+#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
#endif // LIBCXXABI_ARM_EHABI
@@ -282,7 +282,7 @@ inline LocalAddressSpace::pint_t LocalAddressSpace::getEncodedP(pint_t &addr,
return result;
}
-#if __APPLE__
+#ifdef __APPLE__
struct dyld_unwind_sections
{
const struct mach_header* mh;
@@ -326,7 +326,7 @@ inline LocalAddressSpace::pint_t LocalAddressSpace::getEncodedP(pint_t &addr,
inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
UnwindInfoSections &info) {
-#if __APPLE__
+#ifdef __APPLE__
dyld_unwind_sections dyldInfo;
if (_dyld_find_unwind_sections((void *)targetAddr, &dyldInfo)) {
info.dso_base = (uintptr_t)dyldInfo.mh;
@@ -339,7 +339,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
return true;
}
#elif LIBCXXABI_ARM_EHABI
- #if _LIBUNWIND_IS_BAREMETAL
+ #ifdef _LIBUNWIND_IS_BAREMETAL
// Bare metal is statically linked, so no need to ask the dynamic loader
info.arm_section = (uintptr_t)(&__exidx_start);
info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);
@@ -360,7 +360,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
-#if __APPLE__
+#ifdef __APPLE__
return checkKeyMgrRegisteredFDEs(targetAddr, *((void**)&fde));
#else
// TO DO: if OS has way to dynamically register FDEs, check that.
@@ -373,7 +373,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
size_t bufLen,
unw_word_t *offset) {
-#if !_LIBUNWIND_IS_BAREMETAL
+#ifndef _LIBUNWIND_IS_BAREMETAL
Dl_info dyldInfo;
if (dladdr((void *)addr, &dyldInfo)) {
if (dyldInfo.dli_sname != NULL) {
@@ -388,7 +388,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
-#if UNW_REMOTE
+#ifdef UNW_REMOTE
/// OtherAddressSpace is used as a template parameter to UnwindCursor when
/// unwinding a thread in the another process. The other process can be a
diff --git a/src/Unwind/UnwindCursor.hpp b/src/Unwind/UnwindCursor.hpp
index ccacd6e..db6e188 100644
--- a/src/Unwind/UnwindCursor.hpp
+++ b/src/Unwind/UnwindCursor.hpp
@@ -19,7 +19,7 @@
#include <pthread.h>
#include <unwind.h>
-#if __APPLE__
+#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
@@ -62,7 +62,7 @@ private:
// These fields are all static to avoid needing an initializer.
// There is only one instance of this class per process.
static pthread_rwlock_t _lock;
-#if __APPLE__
+#ifdef __APPLE__
static void dyldUnloadHook(const struct mach_header *mh, intptr_t slide);
static bool _registeredForDyldUnloads;
#endif
@@ -91,7 +91,7 @@ typename DwarfFDECache<A>::entry DwarfFDECache<A>::_initialBuffer[64];
template <typename A>
pthread_rwlock_t DwarfFDECache<A>::_lock = PTHREAD_RWLOCK_INITIALIZER;
-#if __APPLE__
+#ifdef __APPLE__
template <typename A>
bool DwarfFDECache<A>::_registeredForDyldUnloads = false;
#endif
@@ -133,7 +133,7 @@ void DwarfFDECache<A>::add(pint_t mh, pint_t ip_start, pint_t ip_end,
_bufferUsed->ip_end = ip_end;
_bufferUsed->fde = fde;
++_bufferUsed;
-#if __APPLE__
+#ifdef __APPLE__
if (!_registeredForDyldUnloads) {
_dyld_register_func_for_remove_image(&dyldUnloadHook);
_registeredForDyldUnloads = true;
@@ -157,7 +157,7 @@ void DwarfFDECache<A>::removeAllIn(pint_t mh) {
_LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_unlock(&_lock));
}
-#if __APPLE__
+#ifdef __APPLE__
template <typename A>
void DwarfFDECache<A>::dyldUnloadHook(const struct mach_header *mh, intptr_t ) {
removeAllIn((pint_t) mh);
@@ -385,7 +385,7 @@ public:
virtual bool getFunctionName(char *bf, size_t ln, unw_word_t *off) = 0;
virtual void setInfoBasedOnIPRegister(bool isReturnAddr = false) = 0;
virtual const char *getRegisterName(int num) = 0;
-#if __arm__
+#ifdef __arm__
virtual void saveVFPAsX() = 0;
#endif
};
@@ -413,7 +413,7 @@ public:
virtual bool getFunctionName(char *buf, size_t len, unw_word_t *off);
virtual void setInfoBasedOnIPRegister(bool isReturnAddress = false);
virtual const char *getRegisterName(int num);
-#if __arm__
+#ifdef __arm__
virtual void saveVFPAsX();
#endif
@@ -588,7 +588,7 @@ template <typename A, typename R> void UnwindCursor<A, R>::jumpto() {
_registers.jumpto();
}
-#if __arm__
+#ifdef __arm__
template <typename A, typename R> void UnwindCursor<A, R>::saveVFPAsX() {
_registers.saveVFPAsX();
}
diff --git a/src/Unwind/UnwindRegistersRestore.S b/src/Unwind/UnwindRegistersRestore.S
index 7dd3a11..38c92fd 100644
--- a/src/Unwind/UnwindRegistersRestore.S
+++ b/src/Unwind/UnwindRegistersRestore.S
@@ -11,7 +11,7 @@
.text
-#if __i386__
+#if defined(__i386__)
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv)
#
# void libunwind::Registers_x86::jumpto()
diff --git a/src/Unwind/UnwindRegistersSave.S b/src/Unwind/UnwindRegistersSave.S
index d6b9a41..7285ff0 100644
--- a/src/Unwind/UnwindRegistersSave.S
+++ b/src/Unwind/UnwindRegistersSave.S
@@ -11,7 +11,7 @@
.text
-#if __i386__
+#if defined(__i386__)
#
# extern int unw_getcontext(unw_context_t* thread_state)
diff --git a/src/Unwind/config.h b/src/Unwind/config.h
index 6b459ee..6a2a8ce 100644
--- a/src/Unwind/config.h
+++ b/src/Unwind/config.h
@@ -28,7 +28,7 @@
#endif
// Platform specific configuration defines.
-#if __APPLE__
+#ifdef __APPLE__
#include <Availability.h>
#ifdef __cplusplus
extern "C" {
@@ -39,9 +39,12 @@
}
#endif
- #define _LIBUNWIND_BUILD_ZERO_COST_APIS (__i386__ || __x86_64__ || __arm64__)
- #define _LIBUNWIND_BUILD_SJLJ_APIS (__arm__)
- #define _LIBUNWIND_SUPPORT_FRAME_APIS (__i386__ || __x86_64__)
+ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \
+ defined(__x86_64__) || \
+ defined(__arm64__))
+ #define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \
+ defined(__x86_64__))
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
@@ -67,9 +70,13 @@
abort();
}
- #define _LIBUNWIND_BUILD_ZERO_COST_APIS (__i386__ || __x86_64__ || __arm64__ || __arm__)
+ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \
+ defined(__x86_64__) || \
+ defined(__arm64__) || \
+ defined(__arm__))
#define _LIBUNWIND_BUILD_SJLJ_APIS 0
- #define _LIBUNWIND_SUPPORT_FRAME_APIS (__i386__ || __x86_64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \
+ defined(__x86_64__))
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
diff --git a/src/Unwind/libunwind.cpp b/src/Unwind/libunwind.cpp
index b80beaf..3b94a5e 100644
--- a/src/Unwind/libunwind.cpp
+++ b/src/Unwind/libunwind.cpp
@@ -43,16 +43,16 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
_LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)\n",
cursor, context);
// Use "placement new" to allocate UnwindCursor in the cursor buffer.
-#if __i386__
+#if defined(__i386__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86>(
context, LocalAddressSpace::sThisAddressSpace);
-#elif __x86_64__
+#elif defined(__x86_64__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86_64>(
context, LocalAddressSpace::sThisAddressSpace);
-#elif __ppc__
+#elif defined(__ppc__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_ppc>(
context, LocalAddressSpace::sThisAddressSpace);
-#elif __arm64__
+#elif defined(__arm64__)
new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm64>(
context, LocalAddressSpace::sThisAddressSpace);
#elif LIBCXXABI_ARM_EHABI
@@ -65,7 +65,7 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
return UNW_ESUCCESS;
}
-#if UNW_REMOTE
+#ifdef UNW_REMOTE
_LIBUNWIND_EXPORT unw_addr_space_t unw_local_addr_space =
(unw_addr_space_t) & sThisAddressSpace;
@@ -287,7 +287,7 @@ _LIBUNWIND_EXPORT int unw_is_signal_frame(unw_cursor_t *cursor) {
return co->isSignalFrame();
}
-#if __arm__
+#ifdef __arm__
// Save VFP registers d0-d15 using FSTMIADX instead of FSTMIADD
_LIBUNWIND_EXPORT void unw_save_vfp_as_X(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("unw_fpreg_save_vfp_as_X(cursor=%p)\n", cursor);
diff --git a/src/abort_message.cpp b/src/abort_message.cpp
index 7702904..6d2a5cb 100644
--- a/src/abort_message.cpp
+++ b/src/abort_message.cpp
@@ -24,7 +24,7 @@ extern "C" void android_set_abort_message(const char* msg);
#pragma GCC visibility push(hidden)
-#if __APPLE__
+#ifdef __APPLE__
# if defined(__has_include) && __has_include(<CrashReporterClient.h>)
# define HAVE_CRASHREPORTERCLIENT_H 1
# include <CrashReporterClient.h>
@@ -35,7 +35,7 @@ __attribute__((visibility("hidden"), noreturn))
void abort_message(const char* format, ...)
{
// write message to stderr
-#if __APPLE__
+#ifdef __APPLE__
fprintf(stderr, "libc++abi.dylib: ");
#endif
va_list list;
@@ -44,7 +44,7 @@ void abort_message(const char* format, ...)
va_end(list);
fprintf(stderr, "\n");
-#if __APPLE__ && HAVE_CRASHREPORTERCLIENT_H
+#if defined(__APPLE__) && HAVE_CRASHREPORTERCLIENT_H
// record message in crash report
char* buffer;
va_list list2;
@@ -52,7 +52,7 @@ void abort_message(const char* format, ...)
vasprintf(&buffer, format, list2);
va_end(list2);
CRSetCrashLogMessage(buffer);
-#elif __BIONIC__
+#elif defined(__BIONIC__)
char* buffer;
va_list list2;
va_start(list2, format);
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index e9f5e6e..f3a6b63 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -234,7 +234,7 @@ __cxa_throw(void* thrown_object, std::type_info* tinfo, void (*dest)(void*))
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local
exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else
_Unwind_RaiseException(&exception_header->unwindHeader);
@@ -571,7 +571,7 @@ __cxa_rethrow()
// nothing
globals->caughtExceptions = 0;
}
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else
_Unwind_RaiseException(&exception_header->unwindHeader);
@@ -700,7 +700,7 @@ __cxa_rethrow_primary_exception(void* thrown_object)
setDependentExceptionClass(&dep_exception_header->unwindHeader);
__cxa_get_globals()->uncaughtExceptions += 1;
dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
#else
_Unwind_RaiseException(&dep_exception_header->unwindHeader);
diff --git a/src/cxa_guard.cpp b/src/cxa_guard.cpp
index 5372a5c..1b41917 100644
--- a/src/cxa_guard.cpp
+++ b/src/cxa_guard.cpp
@@ -31,7 +31,7 @@ namespace __cxxabiv1
namespace
{
-#if __arm__
+#ifdef __arm__
// A 32-bit, 4-byte-aligned static data value. The least significant 2 bits must
// be statically initialized to 0.
diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp
index 3385ea3..3ea8ca3 100644
--- a/src/cxa_personality.cpp
+++ b/src/cxa_personality.cpp
@@ -55,7 +55,7 @@
+------------------+--+-----+-----+------------------------+--------------------------+
| callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table |
+---------------------+-----------+---------------------------------------------------+
-#if !__USING_SJLJ_EXCEPTIONS__
+#ifndef __USING_SJLJ_EXCEPTIONS__
+---------------------+-----------+------------------------------------------------+
| Beginning of Call Site Table The current ip lies within the |
| ... (start, length) range of one of these |
@@ -595,7 +595,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
// Get beginning current frame's code (as defined by the
// emitted dwarf code)
uintptr_t funcStart = _Unwind_GetRegionStart(context);
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
if (ip == uintptr_t(-1))
{
// no action
@@ -628,7 +628,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
// Walk call-site table looking for range that
// includes current PC.
uint8_t callSiteEncoding = *lsda++;
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
(void)callSiteEncoding; // When using SjLj exceptions, callSiteEncoding is never used
#endif
uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda));
@@ -639,7 +639,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
while (callSitePtr < callSiteTableEnd)
{
// There is one entry per call site.
-#if !__USING_SJLJ_EXCEPTIONS__
+#ifndef __USING_SJLJ_EXCEPTIONS__
// The call sites are non-overlapping in [start, start+length)
// The call sites are ordered in increasing value of start
uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
@@ -655,7 +655,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
#endif // __USING_SJLJ_EXCEPTIONS__
{
// Found the call site containing ip.
-#if !__USING_SJLJ_EXCEPTIONS__
+#ifndef __USING_SJLJ_EXCEPTIONS__
if (landingPad == 0)
{
// No handler here
@@ -857,7 +857,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
action += actionOffset;
} // there is no break out of this loop, only return
}
-#if !__USING_SJLJ_EXCEPTIONS__
+#ifndef __USING_SJLJ_EXCEPTIONS__
else if (ipOffset < start)
{
// There is no call site for this ip
@@ -923,7 +923,7 @@ _UA_CLEANUP_PHASE
#if !LIBCXXABI_ARM_EHABI
_Unwind_Reason_Code
-#if __USING_SJLJ_EXCEPTIONS__
+#ifdef __USING_SJLJ_EXCEPTIONS__
__gxx_personality_sj0
#else
__gxx_personality_v0
diff --git a/src/private_typeinfo.cpp b/src/private_typeinfo.cpp
index 38e70ab..821796f 100644
--- a/src/private_typeinfo.cpp
+++ b/src/private_typeinfo.cpp
@@ -34,7 +34,7 @@
//
// _LIBCXX_DYNAMIC_FALLBACK is currently off by default.
-#if _LIBCXX_DYNAMIC_FALLBACK
+#ifdef _LIBCXX_DYNAMIC_FALLBACK
#include "abort_message.h"
#include <string.h>
#include <sys/syslog.h>
@@ -57,7 +57,7 @@ namespace __cxxabiv1
#pragma GCC visibility push(hidden)
-#if _LIBCXX_DYNAMIC_FALLBACK
+#ifdef _LIBCXX_DYNAMIC_FALLBACK
inline
bool
@@ -515,7 +515,7 @@ __dynamic_cast(const void* static_ptr,
info.number_of_dst_type = 1;
// Do the search
dynamic_type->search_above_dst(&info, dynamic_ptr, dynamic_ptr, public_path, false);
-#if _LIBCXX_DYNAMIC_FALLBACK
+#ifdef _LIBCXX_DYNAMIC_FALLBACK
// The following if should always be false because we should definitely
// find (static_ptr, static_type), either on a public or private path
if (info.path_dst_ptr_to_static_ptr == unknown)
@@ -539,7 +539,7 @@ __dynamic_cast(const void* static_ptr,
{
// Not using giant short cut. Do the search
dynamic_type->search_below_dst(&info, dynamic_ptr, public_path, false);
- #if _LIBCXX_DYNAMIC_FALLBACK
+ #ifdef _LIBCXX_DYNAMIC_FALLBACK
// The following if should always be false because we should definitely
// find (static_ptr, static_type), either on a public or private path
if (info.path_dst_ptr_to_static_ptr == unknown &&