xref: /freebsd/contrib/llvm-project/libcxx/include/__configuration/compiler.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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_ENABLE_COMPILER_VERSION_CHECKS) // FreeBSD customization
36 #  if defined(_LIBCPP_CLANG_VER)
37 #    if _LIBCPP_CLANG_VER < 1700
38 #      warning "Libc++ only supports Clang 17 and later"
39 #    endif
40 #  elif defined(_LIBCPP_APPLE_CLANG_VER)
41 #    if _LIBCPP_APPLE_CLANG_VER < 1500
42 #      warning "Libc++ only supports AppleClang 15 and later"
43 #    endif
44 #  elif defined(_LIBCPP_GCC_VER)
45 #    if _LIBCPP_GCC_VER < 1400
46 #      warning "Libc++ only supports GCC 14 and later"
47 #    endif
48 #  endif
49 #endif // _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS
50 
51 #endif
52 
53 #endif // _LIBCPP___CONFIGURATION_COMPILER_H
54