[libcxx-commits] [PATCH] D151387: [libc++][libunwind] Fixes to allow GCC 13 to compile libunwind/libc++abi/libc++

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 24 16:24:21 PDT 2023


philnik created this revision.
philnik added a reviewer: ldionne.
Herald added a project: All.
philnik requested review of this revision.
Herald added projects: libc++, libunwind.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libunwind.

These are changes to allow GCC 13 to successfully compile the runtimes stack.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151387

Files:
  libcxx/include/__type_traits/remove_cv.h
  libcxx/include/__type_traits/remove_cvref.h
  libunwind/src/CMakeLists.txt


Index: libunwind/src/CMakeLists.txt
===================================================================
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -158,7 +158,7 @@
   set_target_properties(unwind_shared
     PROPERTIES
       LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
-      LINKER_LANGUAGE C
+      LINKER_LANGUAGE CXX
       OUTPUT_NAME "${LIBUNWIND_SHARED_OUTPUT_NAME}"
       VERSION "1.0"
       SOVERSION "1"
Index: libcxx/include/__type_traits/remove_cvref.h
===================================================================
--- libcxx/include/__type_traits/remove_cvref.h
+++ libcxx/include/__type_traits/remove_cvref.h
@@ -20,12 +20,25 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_builtin(__remove_cvref)
+#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC)
+
 template <class _Tp>
 using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
+
 #else
+
 template <class _Tp>
-using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
+struct __libcpp_remove_cvref {
+#if __has_builtin(__remove_cvref)
+    using type _LIBCPP_NODEBUG = __remove_cvref(_Tp);
+#else
+    using type _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
+#endif
+};
+
+template <class _Tp>
+using __remove_cvref_t _LIBCPP_NODEBUG = typename __libcpp_remove_cvref<_Tp>::type;
+
 #endif // __has_builtin(__remove_cvref)
 
 template <class _Tp, class _Up>
Index: libcxx/include/__type_traits/remove_cv.h
===================================================================
--- libcxx/include/__type_traits/remove_cv.h
+++ libcxx/include/__type_traits/remove_cv.h
@@ -19,22 +19,31 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC)
+
+template <class _Tp>
+using __remove_cv_t = __remove_cv(_Tp);
+#else
 #if __has_builtin(__remove_cv)
 template <class _Tp>
-struct remove_cv {
+struct __libcpp_remove_cv {
   using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
 };
 
 template <class _Tp>
-using __remove_cv_t = __remove_cv(_Tp);
+using __remove_cv_t = typename __libcpp_remove_cv<_Tp>::type;
 #else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
-{typedef __remove_volatile_t<__remove_const_t<_Tp> > type;};
-
 template <class _Tp>
 using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >;
 #endif // __has_builtin(__remove_cv)
 
+#endif // __has_builtin(__remove_cv)
+
+template <class _Tp>
+struct remove_cv {
+  using type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>;
+};
+
 #if _LIBCPP_STD_VER >= 14
 template <class _Tp> using remove_cv_t = __remove_cv_t<_Tp>;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151387.525365.patch
Type: text/x-patch
Size: 2612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230524/f007da2b/attachment-0001.bin>


More information about the libcxx-commits mailing list