[libcxxabi] r228257 - Enable -Wundef.

Dan Albert danalbert at google.com
Wed Feb 4 17:33:15 PST 2015


Author: danalbert
Date: Wed Feb  4 19:33:15 2015
New Revision: 228257

URL: http://llvm.org/viewvc/llvm-project?rev=228257&view=rev
Log:
Enable -Wundef.

The problem that caused the need for http://reviews.llvm.org/D7419 was
caused by testing the value of something that was undefined. This
should prevent that in the future.

Modified:
    libcxxabi/trunk/CMakeLists.txt
    libcxxabi/trunk/cmake/config-ix.cmake
    libcxxabi/trunk/include/cxxabi.h
    libcxxabi/trunk/include/libunwind.h
    libcxxabi/trunk/include/unwind.h
    libcxxabi/trunk/src/Unwind/AddressSpace.hpp
    libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
    libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S
    libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S
    libcxxabi/trunk/src/Unwind/config.h
    libcxxabi/trunk/src/Unwind/libunwind.cpp
    libcxxabi/trunk/src/abort_message.cpp
    libcxxabi/trunk/src/cxa_exception.cpp
    libcxxabi/trunk/src/cxa_guard.cpp
    libcxxabi/trunk/src/cxa_personality.cpp
    libcxxabi/trunk/src/private_typeinfo.cpp

Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Wed Feb  4 19:33:15 2015
@@ -221,6 +221,7 @@ append_if(LIBCXXABI_COMPILE_FLAGS LIBCXX
 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)

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Wed Feb  4 19:33:15 2015
@@ -25,6 +25,7 @@ check_cxx_compiler_flag(-Wsign-compare
 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)

Modified: libcxxabi/trunk/include/cxxabi.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/cxxabi.h?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/include/cxxabi.h (original)
+++ libcxxabi/trunk/include/cxxabi.h Wed Feb  4 19:33:15 2015
@@ -77,7 +77,7 @@ extern LIBCXXABI_NORETURN void __cxa_pur
 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*);

Modified: libcxxabi/trunk/include/libunwind.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/libunwind.h?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/include/libunwind.h (original)
+++ libcxxabi/trunk/include/libunwind.h Wed Feb  4 19:33:15 2015
@@ -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 *, u
 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_curso
 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_s
 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

Modified: libcxxabi/trunk/include/unwind.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/unwind.h?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/include/unwind.h (original)
+++ libcxxabi/trunk/include/unwind.h Wed Feb  4 19:33:15 2015
@@ -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
 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(_Unw
 //
 //  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

Modified: libcxxabi/trunk/src/Unwind/AddressSpace.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/AddressSpace.hpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/AddressSpace.hpp (original)
+++ libcxxabi/trunk/src/Unwind/AddressSpace.hpp Wed Feb  4 19:33:15 2015
@@ -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
 // 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 LocalAd
   return result;
 }
 
-#if __APPLE__ 
+#ifdef __APPLE__ 
   struct dyld_unwind_sections
   {
     const struct mach_header*   mh;
@@ -326,7 +326,7 @@ inline LocalAddressSpace::pint_t LocalAd
 
 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::findUnwin
     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::findUnwin
 
 
 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::findOther
 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::findFunct
 
 
 
-#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

Modified: libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindCursor.hpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindCursor.hpp (original)
+++ libcxxabi/trunk/src/Unwind/UnwindCursor.hpp Wed Feb  4 19:33:15 2015
@@ -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 DwarfFD
 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, pi
   _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_
   _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 U
   _registers.jumpto();
 }
 
-#if __arm__
+#ifdef __arm__
 template <typename A, typename R> void UnwindCursor<A, R>::saveVFPAsX() {
   _registers.saveVFPAsX();
 }

Modified: libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S (original)
+++ libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S Wed Feb  4 19:33:15 2015
@@ -11,7 +11,7 @@
 
   .text
 
-#if __i386__
+#if defined(__i386__)
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv)
 #
 # void libunwind::Registers_x86::jumpto()

Modified: libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S (original)
+++ libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S Wed Feb  4 19:33:15 2015
@@ -11,7 +11,7 @@
 
     .text
 
-#if __i386__
+#if defined(__i386__)
 
 #
 # extern int unw_getcontext(unw_context_t* thread_state)

Modified: libcxxabi/trunk/src/Unwind/config.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/config.h?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/config.h (original)
+++ libcxxabi/trunk/src/Unwind/config.h Wed Feb  4 19:33:15 2015
@@ -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__)

Modified: libcxxabi/trunk/src/Unwind/libunwind.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/libunwind.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/libunwind.cpp (original)
+++ libcxxabi/trunk/src/Unwind/libunwind.cpp Wed Feb  4 19:33:15 2015
@@ -43,16 +43,16 @@ _LIBUNWIND_EXPORT int unw_init_local(unw
   _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
   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_fram
   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);

Modified: libcxxabi/trunk/src/abort_message.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/abort_message.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/abort_message.cpp (original)
+++ libcxxabi/trunk/src/abort_message.cpp Wed Feb  4 19:33:15 2015
@@ -24,7 +24,7 @@ extern "C" void android_set_abort_messag
 
 #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"), nor
 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);

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Wed Feb  4 19:33:15 2015
@@ -234,7 +234,7 @@ __cxa_throw(void* thrown_object, std::ty
     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* th
         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);

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Wed Feb  4 19:33:15 2015
@@ -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.

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Wed Feb  4 19:33:15 2015
@@ -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 &re
     // 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 &re
     // 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 &re
     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 &re
 #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 &re
                 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

Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=228257&r1=228256&r2=228257&view=diff
==============================================================================
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Wed Feb  4 19:33:15 2015
@@ -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 &&





More information about the cfe-commits mailing list