[libcxx-commits] [libcxx] 2b7f11a - [libc++] Warn if an unsupported compiler is used

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 19 20:46:02 PDT 2023


Author: Nikolas Klauser
Date: 2023-09-19T23:45:49-04:00
New Revision: 2b7f11a6523b716a385e344a778a6ccea5255e38

URL: https://github.com/llvm/llvm-project/commit/2b7f11a6523b716a385e344a778a6ccea5255e38
DIFF: https://github.com/llvm/llvm-project/commit/2b7f11a6523b716a385e344a778a6ccea5255e38.diff

LOG: [libc++] Warn if an unsupported compiler is used

This makes it obvious that libc++ is used in an unsupported configuration,
and the compiler probably has to be updated. It often happens that people
try to use libc++ and don't realize that their compiler is too old.

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

Added: 
    

Modified: 
    libcxx/include/__config

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index bf2564e2732ba98..f301b6450992dcd 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -25,10 +25,27 @@
 #  define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
 #elif defined(__GNUC__)
 #  define _LIBCPP_COMPILER_GCC
+#  define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
 #endif
 
 #ifdef __cplusplus
 
+// Warn if a compiler version is used that is not supported anymore
+// LLVM RELEASE Update the minimum compiler versions
+#  if defined(_LIBCPP_CLANG_VER)
+#    if _LIBCPP_CLANG_VER < 1500
+#      warning "Libc++ only supports Clang 15 and later"
+#    endif
+#  elif defined(_LIBCPP_APPLE_CLANG_VER)
+#    if _LIBCPP_APPLE_CLANG_VER < 1400
+#      warning "Libc++ only supports AppleClang 14 and later"
+#    endif
+#  elif defined(_LIBCPP_GCC_VER)
+#    if _LIBCPP_GCC_VER < 1300
+#      warning "Libc++ only supports GCC 13 and later"
+#    endif
+#  endif
+
 // The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html
 
 // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.


        


More information about the libcxx-commits mailing list