[libcxxabi] r231344 - Fix build with GCC:

Nick Lewycky nicholas at mxc.ca
Wed Mar 4 18:56:05 PST 2015


Author: nicholas
Date: Wed Mar  4 20:56:05 2015
New Revision: 231344

URL: http://llvm.org/viewvc/llvm-project?rev=231344&view=rev
Log:
Fix build with GCC:
 - GCC doesn't support #pragma mark, only Apple GCC and clang. Wrap the pragma mark's in #if 0 to make gcc ignore them but xcode still see them.
 - Wrap a bunch of "#pragma clang" lines in #ifdef __clang__.
 - Pacify gcc's -Wparenthesis in a case where it's quite reasonable.

Modified:
    libcxxabi/trunk/src/cxa_demangle.cpp
    libcxxabi/trunk/src/cxa_vector.cpp
    libcxxabi/trunk/src/private_typeinfo.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=231344&r1=231343&r2=231344&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed Mar  4 20:56:05 2015
@@ -4711,7 +4711,7 @@ class arena
 
     std::size_t 
     align_up(std::size_t n) noexcept
-        {return n + (alignment-1) & ~(alignment-1);}
+        {return (n + (alignment-1)) & ~(alignment-1);}
 
     bool
     pointer_in_buffer(char* p) noexcept

Modified: libcxxabi/trunk/src/cxa_vector.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_vector.cpp?rev=231344&r1=231343&r2=231344&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_vector.cpp (original)
+++ libcxxabi/trunk/src/cxa_vector.cpp Wed Mar  4 20:56:05 2015
@@ -17,7 +17,9 @@
 
 namespace __cxxabiv1 {
 
+#if 0
 #pragma mark --Helper routines and classes --
+#endif
 
 namespace {
     inline static size_t __get_element_count ( void *p ) {
@@ -102,7 +104,9 @@ namespace {
     };
 }
 
+#if 0
 #pragma mark --Externally visible routines--
+#endif
 
 extern "C" {
 

Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=231344&r1=231343&r2=231344&view=diff
==============================================================================
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Wed Mar  4 20:56:05 2015
@@ -219,8 +219,10 @@ __enum_type_info::can_catch(const __shim
     return is_equal(this, thrown_type, false);
 }
 
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wmissing-field-initializers"
+#endif
 
 // Handles bullets 1 and 2
 bool
@@ -246,7 +248,9 @@ __class_type_info::can_catch(const __shi
     return false;
 }
 
+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif
 
 void
 __class_type_info::process_found_base_class(__dynamic_cast_info* info,
@@ -351,8 +355,10 @@ __pbase_type_info::can_catch(const __shi
            is_equal(thrown_type, &typeid(std::nullptr_t), false);
 }
 
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wmissing-field-initializers"
+#endif
 
 // Handles bullets 1, 3 and 4
 // NOTE: It might not be safe to adjust the pointer if it is not not a pointer
@@ -403,13 +409,17 @@ __pointer_type_info::can_catch(const __s
     return false;
 }
 
+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif
 
 #pragma GCC visibility pop
 #pragma GCC visibility push(default)
 
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wmissing-field-initializers"
+#endif
 
 // __dynamic_cast
 
@@ -578,7 +588,9 @@ __dynamic_cast(const void* static_ptr,
     return const_cast<void*>(dst_ptr);
 }
 
+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif
 
 #pragma GCC visibility pop
 #pragma GCC visibility push(hidden)





More information about the cfe-commits mailing list