[PATCH] D30459: [libcxxabi] Clean up macro usage

2017-03-01 Thread Ranjeet Singh via Phabricator via cfe-commits
rs added a comment.

ok thanks.


https://reviews.llvm.org/D30459



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30459: [libcxxabi] Clean up macro usage

2017-03-01 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296612: [libcxxabi] Clean up macro usage. (authored by 
rsingh).

Changed prior to commit:
  https://reviews.llvm.org/D30459?vs=90150=90155#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30459

Files:
  libcxxabi/trunk/CMakeLists.txt
  libcxxabi/trunk/include/__cxxabi_config.h
  libcxxabi/trunk/include/cxxabi.h
  libcxxabi/trunk/src/abort_message.cpp
  libcxxabi/trunk/src/config.h
  libcxxabi/trunk/src/cxa_default_handlers.cpp
  libcxxabi/trunk/src/cxa_exception.cpp
  libcxxabi/trunk/src/cxa_exception.hpp
  libcxxabi/trunk/src/cxa_personality.cpp

Index: libcxxabi/trunk/src/abort_message.cpp
===
--- libcxxabi/trunk/src/abort_message.cpp
+++ libcxxabi/trunk/src/abort_message.cpp
@@ -32,7 +32,7 @@
 void abort_message(const char* format, ...)
 {
 // write message to stderr
-#if !defined(NDEBUG) || !LIBCXXABI_BAREMETAL
+#if !defined(NDEBUG) || !defined(LIBCXXABI_BAREMETAL)
 #ifdef __APPLE__
 fprintf(stderr, "libc++abi.dylib: ");
 #endif
Index: libcxxabi/trunk/src/config.h
===
--- libcxxabi/trunk/src/config.h
+++ libcxxabi/trunk/src/config.h
@@ -16,18 +16,4 @@
 
 #include 
 
-// Set this in the CXXFLAGS when you need it, because otherwise we'd have to
-// #if !defined(__linux__) && !defined(__APPLE__) && ...
-// and so-on for *every* platform.
-#ifndef LIBCXXABI_BAREMETAL
-#  define LIBCXXABI_BAREMETAL 0
-#endif
-
-// The default terminate handler attempts to demangle uncaught exceptions, which
-// causes extra I/O and demangling code to be pulled in.
-// Set this to make the terminate handler default to a silent alternative.
-#ifndef LIBCXXABI_SILENT_TERMINATE
-#  define LIBCXXABI_SILENT_TERMINATE 0
-#endif
-
 #endif // LIBCXXABI_CONFIG_H
Index: libcxxabi/trunk/src/cxa_personality.cpp
===
--- libcxxabi/trunk/src/cxa_personality.cpp
+++ libcxxabi/trunk/src/cxa_personality.cpp
@@ -317,7 +317,7 @@
 std::terminate();
 }
 
-#if _LIBCXXABI_ARM_EHABI
+#if defined(_LIBCXXABI_ARM_EHABI)
 static const void* read_target2_value(const void* ptr)
 {
 uintptr_t offset = *reinterpret_cast(ptr);
@@ -328,7 +328,7 @@
 // deferred to the linker. For bare-metal they turn into absolute
 // relocations. For linux they turn into GOT-REL relocations."
 // https://gcc.gnu.org/ml/gcc-patches/2009-08/msg00264.html
-#if LIBCXXABI_BAREMETAL
+#if defined(LIBCXXABI_BAREMETAL)
 return reinterpret_cast(reinterpret_cast(ptr) +
  offset);
 #else
@@ -358,7 +358,7 @@
 return reinterpret_cast(
 read_target2_value(ttypePtr));
 }
-#else // !_LIBCXXABI_ARM_EHABI
+#else // !defined(_LIBCXXABI_ARM_EHABI)
 static
 const __shim_type_info*
 get_shim_type_info(uint64_t ttypeIndex, const uint8_t* classInfo,
@@ -394,7 +394,7 @@
 classInfo -= ttypeIndex;
 return (const __shim_type_info*)readEncodedPointer(, ttypeEncoding);
 }
-#endif // !_LIBCXXABI_ARM_EHABI
+#endif // !defined(_LIBCXXABI_ARM_EHABI)
 
 /*
 This is checking a thrown exception type, excpType, against a possibly empty
@@ -405,7 +405,7 @@
 the list will catch a excpType.  If any catchType in the list can catch an
 excpType, then this exception spec does not catch the excpType.
 */
-#if _LIBCXXABI_ARM_EHABI
+#if defined(_LIBCXXABI_ARM_EHABI)
 static
 bool
 exception_spec_can_catch(int64_t specIndex, const uint8_t* classInfo,
@@ -934,7 +934,7 @@
 Else a cleanup is not found: return _URC_CONTINUE_UNWIND
 */
 
-#if !_LIBCXXABI_ARM_EHABI
+#if !defined(_LIBCXXABI_ARM_EHABI)
 _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code
 #ifdef __USING_SJLJ_EXCEPTIONS__
 __gxx_personality_sj0
@@ -1194,7 +1194,7 @@
 u_handler = old_exception_header->unexpectedHandler;
 // If std::__unexpected(u_handler) rethrows the same exception,
 //   these values get overwritten by the rethrow.  So save them now:
-#if _LIBCXXABI_ARM_EHABI
+#if defined(_LIBCXXABI_ARM_EHABI)
 ttypeIndex = (int64_t)(int32_t)unwind_exception->barrier_cache.bitpattern[4];
 lsda = (const uint8_t*)unwind_exception->barrier_cache.bitpattern[2];
 #else
Index: libcxxabi/trunk/src/cxa_default_handlers.cpp
===
--- libcxxabi/trunk/src/cxa_default_handlers.cpp
+++ libcxxabi/trunk/src/cxa_default_handlers.cpp
@@ -85,7 +85,7 @@
 std::terminate();
 }
 
-#if !LIBCXXABI_SILENT_TERMINATE
+#if !defined(LIBCXXABI_SILENT_TERMINATE)
 static std::terminate_handler default_terminate_handler = demangling_terminate_handler;
 static std::terminate_handler default_unexpected_handler = demangling_unexpected_handler;
 #else
Index: libcxxabi/trunk/src/cxa_exception.hpp
===
--- libcxxabi/trunk/src/cxa_exception.hpp
+++ 

[PATCH] D30459: [libcxxabi] Clean up macro usage

2017-03-01 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath added a comment.

In https://reviews.llvm.org/D30459#689461, @rs wrote:

> Thanks for reviewing. Before I commit could you tell me if I need to update 
> any build systems e.g. buildbots ?


Those two options are not used by any of the current public builders, so I 
think it's safe to commit.

If something breaks, we can revert and have a look :)


https://reviews.llvm.org/D30459



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30459: [libcxxabi] Clean up macro usage

2017-02-28 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

I renamed `LIBCXXABI_ARM_EHABI` to `_LIBCXXABI_ARM_EHABI` so you'll have to 
merge this change with that.

Other than that this LGTM.


https://reviews.llvm.org/D30459



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30459: [libcxxabi] Clean up macro usage

2017-02-28 Thread Ranjeet Singh via Phabricator via cfe-commits
rs created this revision.
Herald added a subscriber: mgorny.

Convention in libcxxabi is to use !defined(FOO) not !FOO.


https://reviews.llvm.org/D30459

Files:
  CMakeLists.txt
  include/__cxxabi_config.h
  include/cxxabi.h
  src/abort_message.cpp
  src/config.h
  src/cxa_default_handlers.cpp
  src/cxa_exception.cpp
  src/cxa_exception.hpp
  src/cxa_personality.cpp

Index: src/cxa_personality.cpp
===
--- src/cxa_personality.cpp
+++ src/cxa_personality.cpp
@@ -317,7 +317,7 @@
 std::terminate();
 }
 
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 static const void* read_target2_value(const void* ptr)
 {
 uintptr_t offset = *reinterpret_cast(ptr);
@@ -328,7 +328,7 @@
 // deferred to the linker. For bare-metal they turn into absolute
 // relocations. For linux they turn into GOT-REL relocations."
 // https://gcc.gnu.org/ml/gcc-patches/2009-08/msg00264.html
-#if LIBCXXABI_BAREMETAL
+#if defined(LIBCXXABI_BAREMETAL)
 return reinterpret_cast(reinterpret_cast(ptr) +
  offset);
 #else
@@ -358,7 +358,7 @@
 return reinterpret_cast(
 read_target2_value(ttypePtr));
 }
-#else // !LIBCXXABI_ARM_EHABI
+#else // !defined(LIBCXXABI_ARM_EHABI
 static
 const __shim_type_info*
 get_shim_type_info(uint64_t ttypeIndex, const uint8_t* classInfo,
@@ -394,7 +394,7 @@
 classInfo -= ttypeIndex;
 return (const __shim_type_info*)readEncodedPointer(, ttypeEncoding);
 }
-#endif // !LIBCXXABI_ARM_EHABI
+#endif // !defined(LIBCXXABI_ARM_EHABI)
 
 /*
 This is checking a thrown exception type, excpType, against a possibly empty
@@ -405,7 +405,7 @@
 the list will catch a excpType.  If any catchType in the list can catch an
 excpType, then this exception spec does not catch the excpType.
 */
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 static
 bool
 exception_spec_can_catch(int64_t specIndex, const uint8_t* classInfo,
@@ -934,7 +934,7 @@
 Else a cleanup is not found: return _URC_CONTINUE_UNWIND
 */
 
-#if !LIBCXXABI_ARM_EHABI
+#if !defined(LIBCXXABI_ARM_EHABI)
 _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code
 #ifdef __USING_SJLJ_EXCEPTIONS__
 __gxx_personality_sj0
@@ -1194,7 +1194,7 @@
 u_handler = old_exception_header->unexpectedHandler;
 // If std::__unexpected(u_handler) rethrows the same exception,
 //   these values get overwritten by the rethrow.  So save them now:
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 ttypeIndex = (int64_t)(int32_t)unwind_exception->barrier_cache.bitpattern[4];
 lsda = (const uint8_t*)unwind_exception->barrier_cache.bitpattern[2];
 #else
Index: src/cxa_exception.hpp
===
--- src/cxa_exception.hpp
+++ src/cxa_exception.hpp
@@ -27,7 +27,7 @@
 static const uint64_t get_vendor_and_language = 0xFF00; // mask for CLNGC++
 
 struct __cxa_exception {
-#if defined(__LP64__) || LIBCXXABI_ARM_EHABI
+#if defined(__LP64__) || defined(LIBCXXABI_ARM_EHABI)
 // This is a new field to support C++ 0x exception_ptr.
 // For binary compatibility it is at the start of this
 // struct which is prepended to the object thrown in
@@ -45,7 +45,7 @@
 
 int handlerCount;
 
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 __cxa_exception* nextPropagatingException;
 int propagationCount;
 #else
@@ -56,7 +56,7 @@
 void *adjustedPtr;
 #endif
 
-#if !defined(__LP64__) && !LIBCXXABI_ARM_EHABI
+#if !defined(__LP64__) && !defined(LIBCXXABI_ARM_EHABI)
 // This is a new field to support C++ 0x exception_ptr.
 // For binary compatibility it is placed where the compiler
 // previously adding padded to 64-bit align unwindHeader.
@@ -70,7 +70,7 @@
 // The layout of this structure MUST match the layout of __cxa_exception, with
 // primaryException instead of referenceCount.
 struct __cxa_dependent_exception {
-#if defined(__LP64__) || LIBCXXABI_ARM_EHABI
+#if defined(__LP64__) || defined(LIBCXXABI_ARM_EHABI)
 void* primaryException;
 #endif
 
@@ -83,7 +83,7 @@
 
 int handlerCount;
 
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 __cxa_exception* nextPropagatingException;
 int propagationCount;
 #else
@@ -94,7 +94,7 @@
 void *adjustedPtr;
 #endif
 
-#if !defined(__LP64__) && !LIBCXXABI_ARM_EHABI
+#if !defined(__LP64__) && !defined(LIBCXXABI_ARM_EHABI)
 void* primaryException;
 #endif
 
@@ -104,7 +104,7 @@
 struct __cxa_eh_globals {
 __cxa_exception *   caughtExceptions;
 unsigned intuncaughtExceptions;
-#if LIBCXXABI_ARM_EHABI
+#if defined(LIBCXXABI_ARM_EHABI)
 __cxa_exception* propagatingExceptions;
 #endif
 };
Index: src/cxa_exception.cpp
===
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -237,16 +237,16 @@
 */
 _LIBCXXABI_FUNC_VIS
 void