[libcxx-commits] [libcxx] 1d75c59 - Fix detection of __datasizeof with Clang. (#94174)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 5 15:29:50 PDT 2024


Author: Eric
Date: 2024-06-05T18:29:46-04:00
New Revision: 1d75c59ace2c9fc4e9a94907748d9555cd4a7d14

URL: https://github.com/llvm/llvm-project/commit/1d75c59ace2c9fc4e9a94907748d9555cd4a7d14
DIFF: https://github.com/llvm/llvm-project/commit/1d75c59ace2c9fc4e9a94907748d9555cd4a7d14.diff

LOG: Fix detection of __datasizeof with Clang. (#94174)

The `__has_extension` builtin macro is the same as __has_feature when
-pedantic-errors is specified, which means we don't get the right
information about __datasizeof being available.

Using __has_keyword (really !__is_identifier) will tell the truth
even when -pedantic-errors is specified.

This means we always have __datasizeof under Clang

Added: 
    

Modified: 
    libcxx/include/__type_traits/datasizeof.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__type_traits/datasizeof.h b/libcxx/include/__type_traits/datasizeof.h
index 54fde242ebcde..35c12921e8ffa 100644
--- a/libcxx/include/__type_traits/datasizeof.h
+++ b/libcxx/include/__type_traits/datasizeof.h
@@ -26,7 +26,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_extension(datasizeof)
+#if __has_keyword(__datasizeof) || __has_extension(datasizeof)
 template <class _Tp>
 inline const size_t __datasizeof_v = __datasizeof(_Tp);
 #else


        


More information about the libcxx-commits mailing list