| 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP___CONFIGURATION_COMPILER_H |
| 11 | #define _LIBCPP___CONFIGURATION_COMPILER_H |
| 12 | |
| 13 | #include <__config_site> |
| 14 | |
| 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 16 | # pragma GCC system_header |
| 17 | #endif |
| 18 | |
| 19 | #if defined(__apple_build_version__) |
| 20 | // Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) |
| 21 | # define _LIBCPP_COMPILER_CLANG_BASED |
| 22 | # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) |
| 23 | #elif defined(__clang__) |
| 24 | # define _LIBCPP_COMPILER_CLANG_BASED |
| 25 | # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) |
| 26 | #elif defined(__GNUC__) |
| 27 | # define _LIBCPP_COMPILER_GCC |
| 28 | # define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) |
| 29 | #endif |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | |
| 33 | // Warn if a compiler version is used that is not supported anymore |
| 34 | // LLVM RELEASE Update the minimum compiler versions |
| 35 | # if defined(_LIBCPP_CLANG_VER) |
| 36 | # if _LIBCPP_CLANG_VER < 2101 |
| 37 | # warning "Libc++ only supports Clang 21 and later" |
| 38 | # endif |
| 39 | # elif defined(_LIBCPP_APPLE_CLANG_VER) |
| 40 | # if _LIBCPP_APPLE_CLANG_VER < 2100 |
| 41 | # warning "Libc++ only supports AppleClang 26.4 and later" |
| 42 | # endif |
| 43 | # elif defined(_LIBCPP_GCC_VER) |
| 44 | # if _LIBCPP_GCC_VER < 1500 |
| 45 | # warning "Libc++ only supports GCC 15 and later" |
| 46 | # endif |
| 47 | # endif |
| 48 | |
| 49 | # ifndef __has_constexpr_builtin |
| 50 | # define __has_constexpr_builtin(x) 0 |
| 51 | # endif |
| 52 | |
| 53 | // This checks wheter a Clang module is built |
| 54 | # ifndef __building_module |
| 55 | # define __building_module(...) 0 |
| 56 | # endif |
| 57 | |
| 58 | // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by |
| 59 | // the compiler and '1' otherwise. |
| 60 | # ifndef __is_identifier |
| 61 | # define __is_identifier(__x) 1 |
| 62 | # endif |
| 63 | |
| 64 | # define __has_keyword(__x) !(__is_identifier(__x)) |
| 65 | |
| 66 | # ifndef __has_warning |
| 67 | # define __has_warning(...) 0 |
| 68 | # endif |
| 69 | |
| 70 | # if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L |
| 71 | # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" |
| 72 | # endif |
| 73 | |
| 74 | #endif |
| 75 | |
| 76 | #endif // _LIBCPP___CONFIGURATION_COMPILER_H |
| 77 | |