[libcxx-commits] [libcxx] 946849f - [libc++] Workaround the absence of the __GLIBC_USE macro in glibc versions prior to 2.25.

Tom Honermann via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 11 13:40:09 PDT 2022


Author: Tom Honermann
Date: 2022-09-11T16:39:37-04:00
New Revision: 946849f6d076dcaebc8b94e2b2eff65224ee27f3

URL: https://github.com/llvm/llvm-project/commit/946849f6d076dcaebc8b94e2b2eff65224ee27f3
DIFF: https://github.com/llvm/llvm-project/commit/946849f6d076dcaebc8b94e2b2eff65224ee27f3.diff

LOG: [libc++] Workaround the absence of the __GLIBC_USE macro in glibc versions prior to 2.25.

This change correct a configuration check that relies on the glibc __GLIBC_USE
macro being defined. Previously, the function-like macro was expanded without
ensuring it was actually defined. This resulted in compilation failures for
glibc versions prior to 2.25 (the glibc version in which the macro was added).

Differential Revision: https://reviews.llvm.org/D130946

Added: 
    

Modified: 
    libcxx/include/__config

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index a6f3b4e88aa1..681c10306420 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1218,7 +1218,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
 // determining the latter depends on internal GNU libc details. If the
 // __cpp_char8_t feature test macro is not defined, then a char8_t typedef
 // will be declared as well.
-#  if defined(_LIBCPP_GLIBC_PREREQ)
+#  if defined(_LIBCPP_GLIBC_PREREQ) && defined(__GLIBC_USE)
 #    if _LIBCPP_GLIBC_PREREQ(2, 36) && (defined(__cpp_char8_t) || __GLIBC_USE(ISOC2X))
 #      undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
 #    endif


        


More information about the libcxx-commits mailing list