This revision was automatically updated to reflect the committed changes. Closed by commit rL299225: [libunwind] Clean up macro usage. (authored by rsingh).
Changed prior to commit: https://reviews.llvm.org/D31078?vs=93646&id=93647#toc Repository: rL LLVM https://reviews.llvm.org/D31078 Files: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/include/unwind.h libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/Unwind-EHABI.cpp libunwind/trunk/src/Unwind-EHABI.h libunwind/trunk/src/Unwind-sjlj.c libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindLevel1-gcc-ext.c libunwind/trunk/src/UnwindLevel1.c libunwind/trunk/src/Unwind_AppleExtras.cpp libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp libunwind/trunk/src/libunwind_ext.h
Index: libunwind/trunk/src/UnwindLevel1.c =================================================================== --- libunwind/trunk/src/UnwindLevel1.c +++ libunwind/trunk/src/UnwindLevel1.c @@ -30,7 +30,7 @@ #include "unwind.h" #include "config.h" -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) static _Unwind_Reason_Code unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { @@ -503,4 +503,4 @@ unw_set_reg(cursor, UNW_REG_IP, value); } -#endif // !_LIBUNWIND_ARM_EHABI +#endif // !defined(_LIBUNWIND_ARM_EHABI) Index: libunwind/trunk/src/Unwind_AppleExtras.cpp =================================================================== --- libunwind/trunk/src/Unwind_AppleExtras.cpp +++ libunwind/trunk/src/Unwind_AppleExtras.cpp @@ -77,7 +77,7 @@ #endif -#if _LIBUNWIND_BUILD_ZERO_COST_APIS +#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) // // symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in @@ -116,12 +116,12 @@ NEVER_HERE(__deregister_frame_info) NEVER_HERE(__deregister_frame_info_bases) -#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS +#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) -#if _LIBUNWIND_BUILD_SJLJ_APIS +#if defined(_LIBUNWIND_BUILD_SJLJ_APIS) // // symbols in libSystem.dylib in iOS 5.0 and later, but are in libgcc_s.dylib in // earlier versions @@ -141,7 +141,7 @@ NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume_or_Rethrow) NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Unregister) -#endif // _LIBUNWIND_BUILD_SJLJ_APIS +#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) namespace libunwind { @@ -184,7 +184,7 @@ } -#if !defined(FOR_DYLD) && _LIBUNWIND_BUILD_SJLJ_APIS +#if !defined(FOR_DYLD) && defined(_LIBUNWIND_BUILD_SJLJ_APIS) #ifndef _LIBUNWIND_HAS_NO_THREADS #include <System/pthread_machdep.h> Index: libunwind/trunk/src/Unwind-EHABI.cpp =================================================================== --- libunwind/trunk/src/Unwind-EHABI.cpp +++ libunwind/trunk/src/Unwind-EHABI.cpp @@ -12,7 +12,7 @@ #include "Unwind-EHABI.h" -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) #include <stdbool.h> #include <stdint.h> @@ -987,4 +987,4 @@ return _URC_OK; } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) Index: libunwind/trunk/src/config.h =================================================================== --- libunwind/trunk/src/config.h +++ libunwind/trunk/src/config.h @@ -32,50 +32,36 @@ // Platform specific configuration defines. #ifdef __APPLE__ #if defined(FOR_DYLD) - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 - #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 + #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND #else - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 + #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 #endif #else #if defined(__ARM_DWARF_EH__) || !defined(__arm__) - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1 - #else - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 #endif #endif // FIXME: these macros are not correct for COFF targets #define _LIBUNWIND_EXPORT __attribute__((visibility("default"))) #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden"))) #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__) -#define _LIBUNWIND_BUILD_SJLJ_APIS 1 -#else -#define _LIBUNWIND_BUILD_SJLJ_APIS 0 +#define _LIBUNWIND_BUILD_SJLJ_APIS #endif #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) -#define _LIBUNWIND_SUPPORT_FRAME_APIS 1 -#else -#define _LIBUNWIND_SUPPORT_FRAME_APIS 0 +#define _LIBUNWIND_SUPPORT_FRAME_APIS #endif #if defined(__i386__) || defined(__x86_64__) || \ defined(__ppc__) || defined(__ppc64__) || \ (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ (defined(__APPLE__) && defined(__mips__)) -#define _LIBUNWIND_BUILD_ZERO_COST_APIS 1 -#else -#define _LIBUNWIND_BUILD_ZERO_COST_APIS 0 +#define _LIBUNWIND_BUILD_ZERO_COST_APIS #endif #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL) Index: libunwind/trunk/src/UnwindCursor.hpp =================================================================== --- libunwind/trunk/src/UnwindCursor.hpp +++ libunwind/trunk/src/UnwindCursor.hpp @@ -38,7 +38,7 @@ namespace libunwind { -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// Cache of recently found FDEs. template <typename A> class _LIBUNWIND_HIDDEN DwarfFDECache { @@ -180,12 +180,12 @@ } _LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_unlock(&_lock)); } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #define arrayoffsetof(type, index, field) ((size_t)(&((type *)0)[index].field)) -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A> class UnwindSectionHeader { public: UnwindSectionHeader(A &addressSpace, typename A::pint_t addr) @@ -373,7 +373,7 @@ A &_addressSpace; typename A::pint_t _addr; }; -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) class _LIBUNWIND_HIDDEN AbstractUnwindCursor { public: @@ -446,7 +446,7 @@ private: -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) bool getInfoFromEHABISection(pint_t pc, const UnwindInfoSections §s); int stepWithEHABI() { @@ -464,7 +464,7 @@ } #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) bool getInfoFromDwarfSection(pint_t pc, const UnwindInfoSections §s, uint32_t fdeSectionOffsetHint=0); int stepWithDwarfFDE() { @@ -475,11 +475,11 @@ } #endif -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) bool getInfoFromCompactEncodingSection(pint_t pc, const UnwindInfoSections §s); int stepWithCompactEncoding() { - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) if ( compactSaysUseDwarf() ) return stepWithDwarfFDE(); #endif @@ -557,9 +557,9 @@ return false; } #endif -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) compact_unwind_encoding_t dwarfEncoding() const { R dummy; return dwarfEncoding(dummy); @@ -594,7 +594,7 @@ return 0; } #endif -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) A &_addressSpace; @@ -672,7 +672,7 @@ return _isSignalFrame; } -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) struct EHABIIndexEntry { uint32_t functionOffset; uint32_t data; @@ -868,7 +868,7 @@ } #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) template <typename A, typename R> bool UnwindCursor<A, R>::getInfoFromDwarfSection(pint_t pc, const UnwindInfoSections §s, @@ -884,7 +884,7 @@ sects.dwarf_section + fdeSectionOffsetHint, &fdeInfo, &cieInfo); } -#if _LIBUNWIND_SUPPORT_DWARF_INDEX +#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) if (!foundFDE && (sects.dwarf_index_section != 0)) { foundFDE = EHHeaderParser<A>::findFDE( _addressSpace, pc, sects.dwarf_index_section, @@ -927,7 +927,7 @@ // Add to cache (to make next lookup faster) if we had no hint // and there was no index. if (!foundInCache && (fdeSectionOffsetHint == 0)) { - #if _LIBUNWIND_SUPPORT_DWARF_INDEX + #if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) if (sects.dwarf_index_section == 0) #endif DwarfFDECache<A>::add(sects.dso_base, fdeInfo.pcStart, fdeInfo.pcEnd, @@ -939,10 +939,10 @@ //_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX", (uint64_t)pc); return false; } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A, typename R> bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc, const UnwindInfoSections §s) { @@ -1196,13 +1196,13 @@ _info.extra = sects.dso_base; return true; } -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A, typename R> void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) { pint_t pc = (pint_t)this->getReg(UNW_REG_IP); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // Remove the thumb bit so the IP represents the actual instruction address. // This matches the behaviour of _Unwind_GetIP on arm. pc &= (pint_t)~0x1; @@ -1219,11 +1219,11 @@ // Ask address space object to find unwind sections for this pc. UnwindInfoSections sects; if (_addressSpace.findUnwindSections(pc, sects)) { -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) // If there is a compact unwind encoding table, look there first. if (sects.compact_unwind_section != 0) { if (this->getInfoFromCompactEncodingSection(pc, sects)) { - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // Found info in table, done unless encoding says to use dwarf. uint32_t dwarfOffset; if ((sects.dwarf_section != 0) && compactSaysUseDwarf(&dwarfOffset)) { @@ -1240,9 +1240,9 @@ return; } } -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // If there is dwarf unwind info, look there next. if (sects.dwarf_section != 0) { if (this->getInfoFromDwarfSection(pc, sects)) { @@ -1252,14 +1252,14 @@ } #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // If there is ARM EHABI unwind info, look there next. if (sects.arm_section != 0 && this->getInfoFromEHABISection(pc, sects)) return; #endif } -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // There is no static unwind info for this pc. Look to see if an FDE was // dynamically registered for it. pint_t cachedFDE = DwarfFDECache<A>::findFDE(0, pc); @@ -1318,7 +1318,7 @@ } } } -#endif // #if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // no unwind info, flag that we can't reliably unwind _unwindInfoMissing = true; @@ -1332,11 +1332,11 @@ // Use unwinding info to modify register set as if function returned. int result; -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) result = this->stepWithCompactEncoding(); -#elif _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) result = this->stepWithDwarfFDE(); -#elif _LIBUNWIND_ARM_EHABI +#elif defined(_LIBUNWIND_ARM_EHABI) result = this->stepWithEHABI(); #else #error Need _LIBUNWIND_SUPPORT_COMPACT_UNWIND or \ Index: libunwind/trunk/src/AddressSpace.hpp =================================================================== --- libunwind/trunk/src/AddressSpace.hpp +++ libunwind/trunk/src/AddressSpace.hpp @@ -39,24 +39,24 @@ /// Used by findUnwindSections() to return info about needed sections. struct UnwindInfoSections { -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND || _LIBUNWIND_SUPPORT_DWARF_INDEX || \ - _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) || defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) || \ + defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) // No dso_base for ARM EHABI. uintptr_t dso_base; #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) uintptr_t dwarf_section; uintptr_t dwarf_section_length; #endif -#if _LIBUNWIND_SUPPORT_DWARF_INDEX +#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) uintptr_t dwarf_index_section; uintptr_t dwarf_index_section_length; #endif -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) uintptr_t compact_unwind_section; uintptr_t compact_unwind_section_length; #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) uintptr_t arm_section; uintptr_t arm_section_length; #endif @@ -313,14 +313,14 @@ } #endif -#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL) +#elif defined(_LIBUNWIND_ARM_EHABI) && 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. extern char __exidx_start; extern char __exidx_end; -#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // ELF-based systems may use dl_iterate_phdr() to access sections // containing unwinding information. The ElfW() macro for pointer-size @@ -340,23 +340,23 @@ dyld_unwind_sections dyldInfo; if (_dyld_find_unwind_sections((void *)targetAddr, &dyldInfo)) { info.dso_base = (uintptr_t)dyldInfo.mh; - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) info.dwarf_section = (uintptr_t)dyldInfo.dwarf_section; info.dwarf_section_length = dyldInfo.dwarf_section_length; #endif info.compact_unwind_section = (uintptr_t)dyldInfo.compact_unwind_section; info.compact_unwind_section_length = dyldInfo.compact_unwind_section_length; return true; } -#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL) +#elif defined(_LIBUNWIND_ARM_EHABI) && defined(_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); _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x", info.arm_section, info.arm_section_length); if (info.arm_section && info.arm_section_length) return true; -#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) struct dl_iterate_cb_data { LocalAddressSpace *addressSpace; UnwindInfoSections *sects; @@ -384,8 +384,8 @@ typedef ElfW(Phdr) Elf_Phdr; #endif - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND - #if !_LIBUNWIND_SUPPORT_DWARF_INDEX + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) + #if !defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform." #endif size_t object_length; @@ -418,7 +418,7 @@ } else { return false; } - #else // _LIBUNWIND_ARM_EHABI + #else // defined(_LIBUNWIND_ARM_EHABI) for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; if (phdr->p_type == PT_LOAD) { Index: libunwind/trunk/src/UnwindLevel1-gcc-ext.c =================================================================== --- libunwind/trunk/src/UnwindLevel1-gcc-ext.c +++ libunwind/trunk/src/UnwindLevel1-gcc-ext.c @@ -23,12 +23,12 @@ #include "Unwind-EHABI.h" #include "unwind.h" -#if _LIBUNWIND_BUILD_ZERO_COST_APIS +#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) /// Called by __cxa_rethrow(). _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) { -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld", (void *)exception_object, (long)exception_object->unwinder_cache.reserved1); @@ -38,7 +38,7 @@ (long)exception_object->private_1); #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0, // which is in the same position as private_1 below. return _Unwind_RaiseException(exception_object); @@ -111,7 +111,7 @@ _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)", (void *)(uintptr_t)callback); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // Create a mock exception object for force unwinding. _Unwind_Exception ex; memset(&ex, '\0', sizeof(ex)); @@ -122,7 +122,7 @@ while (true) { _Unwind_Reason_Code result; -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) // ask libunwind to get next frame (skip over first frame which is // _Unwind_Backtrace()) if (unw_step(&cursor) <= 0) { @@ -154,7 +154,7 @@ _URC_CONTINUE_UNWIND) { return _URC_END_OF_STACK; } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) // debugging if (_LIBUNWIND_TRACING_UNWINDING) { @@ -222,7 +222,7 @@ return _Unwind_GetIP(context); } -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// Called by programs with dynamic code generators that want /// to register a dynamically generated FDE. @@ -252,7 +252,7 @@ // applications working. We also add the not in 10.6 symbol so that nwe // application won't be able to use them. -#if _LIBUNWIND_SUPPORT_FRAME_APIS +#if defined(_LIBUNWIND_SUPPORT_FRAME_APIS) _LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob, void *tb, void *db) { (void)fde; @@ -309,8 +309,8 @@ // do nothing, this function never worked in Mac OS X return NULL; } -#endif // _LIBUNWIND_SUPPORT_FRAME_APIS +#endif // defined(_LIBUNWIND_SUPPORT_FRAME_APIS) -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) -#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS +#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) Index: libunwind/trunk/src/Unwind-sjlj.c =================================================================== --- libunwind/trunk/src/Unwind-sjlj.c +++ libunwind/trunk/src/Unwind-sjlj.c @@ -32,7 +32,7 @@ // function also sets the personality and lsda fields of the block. // -#if _LIBUNWIND_BUILD_SJLJ_APIS +#if defined(_LIBUNWIND_BUILD_SJLJ_APIS) struct _Unwind_FunctionContext { // next function in stack of handlers @@ -465,4 +465,4 @@ return 0; } -#endif // _LIBUNWIND_BUILD_SJLJ_APIS +#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) Index: libunwind/trunk/src/libunwind.cpp =================================================================== --- libunwind/trunk/src/libunwind.cpp +++ libunwind/trunk/src/libunwind.cpp @@ -54,7 +54,7 @@ # define REGISTER_KIND Registers_ppc #elif defined(__aarch64__) # define REGISTER_KIND Registers_arm64 -#elif _LIBUNWIND_ARM_EHABI +#elif defined(_LIBUNWIND_ARM_EHABI) # define REGISTER_KIND Registers_arm #elif defined(__or1k__) # define REGISTER_KIND Registers_or1k @@ -207,7 +207,7 @@ /// Set value of specified float register at cursor position in stack frame. _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum, unw_fpreg_t value) { -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)", static_cast<void *>(cursor), regNum, value); #else @@ -306,7 +306,7 @@ #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// SPI: walks cached DWARF entries _LIBUNWIND_EXPORT void unw_iterate_dwarf_unwind_cache(void (*func)( unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh)) { @@ -340,7 +340,7 @@ // fde is own mh_group DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde); } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) Index: libunwind/trunk/src/libunwind_ext.h =================================================================== --- libunwind/trunk/src/libunwind_ext.h +++ libunwind/trunk/src/libunwind_ext.h @@ -33,7 +33,7 @@ extern void _unw_add_dynamic_fde(unw_word_t fde); extern void _unw_remove_dynamic_fde(unw_word_t fde); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*); extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context, const uint32_t *data, Index: libunwind/trunk/src/Unwind-EHABI.h =================================================================== --- libunwind/trunk/src/Unwind-EHABI.h +++ libunwind/trunk/src/Unwind-EHABI.h @@ -13,7 +13,7 @@ #include <__libunwind_config.h> -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) #include <stdint.h> #include <unwind.h> @@ -46,6 +46,6 @@ } // extern "C" #endif -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) #endif // __UNWIND_EHABI_H__ Index: libunwind/trunk/include/unwind.h =================================================================== --- libunwind/trunk/include/unwind.h +++ libunwind/trunk/include/unwind.h @@ -36,7 +36,7 @@ _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, _URC_CONTINUE_UNWIND = 8, -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _URC_FAILURE = 9 #endif } _Unwind_Reason_Code; @@ -51,7 +51,7 @@ typedef struct _Unwind_Context _Unwind_Context; // opaque -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef uint32_t _Unwind_State; static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; @@ -168,7 +168,7 @@ #endif extern void _Unwind_DeleteException(_Unwind_Exception *exception_object); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef enum { _UVRSC_CORE = 0, /* integer register */ _UVRSC_VFP = 1, /* vfp */ @@ -208,15 +208,15 @@ _Unwind_VRS_DataRepresentation representation); #endif -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index); extern void _Unwind_SetGR(struct _Unwind_Context *context, int index, uintptr_t new_value); extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context); extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value); -#else // _LIBUNWIND_ARM_EHABI +#else // defined(_LIBUNWIND_ARM_EHABI) #if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE) #define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern @@ -255,7 +255,7 @@ uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1); _Unwind_SetGR(context, 15, value | thumb_bit); } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context); extern uintptr_t Index: libunwind/trunk/include/__libunwind_config.h =================================================================== --- libunwind/trunk/include/__libunwind_config.h +++ libunwind/trunk/include/__libunwind_config.h @@ -12,14 +12,12 @@ #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ !defined(__ARM_DWARF_EH__) -#define _LIBUNWIND_ARM_EHABI 1 -#else -#define _LIBUNWIND_ARM_EHABI 0 +#define _LIBUNWIND_ARM_EHABI #endif #if defined(_LIBUNWIND_IS_NATIVE_ONLY) # if defined(__i386__) -# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_CONTEXT_SIZE 8 # define _LIBUNWIND_CURSOR_SIZE 19 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9 @@ -57,7 +55,7 @@ # error "Unsupported architecture." # endif #else // !_LIBUNWIND_IS_NATIVE_ONLY -# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_TARGET_X86_64 1 # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_TARGET_AARCH64 1 Index: libunwind/trunk/include/libunwind.h =================================================================== --- libunwind/trunk/include/libunwind.h +++ libunwind/trunk/include/libunwind.h @@ -72,7 +72,7 @@ typedef struct unw_addr_space *unw_addr_space_t; typedef int unw_regnum_t; -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef uint32_t unw_word_t; typedef uint64_t unw_fpreg_t; #else
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits