xref: /freebsd/contrib/llvm-project/libcxx/include/__configuration/compiler.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1*0fca6ea1SDimitry Andric // -*- C++ -*-
2*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
3*0fca6ea1SDimitry Andric //
4*0fca6ea1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*0fca6ea1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6*0fca6ea1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*0fca6ea1SDimitry Andric //
8*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
9*0fca6ea1SDimitry Andric 
10*0fca6ea1SDimitry Andric #ifndef _LIBCPP___CONFIGURATION_COMPILER_H
11*0fca6ea1SDimitry Andric #define _LIBCPP___CONFIGURATION_COMPILER_H
12*0fca6ea1SDimitry Andric 
13*0fca6ea1SDimitry Andric #include <__config_site>
14*0fca6ea1SDimitry Andric 
15*0fca6ea1SDimitry Andric #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
16*0fca6ea1SDimitry Andric #  pragma GCC system_header
17*0fca6ea1SDimitry Andric #endif
18*0fca6ea1SDimitry Andric 
19*0fca6ea1SDimitry Andric #if defined(__apple_build_version__)
20*0fca6ea1SDimitry Andric // Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403)
21*0fca6ea1SDimitry Andric #  define _LIBCPP_COMPILER_CLANG_BASED
22*0fca6ea1SDimitry Andric #  define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
23*0fca6ea1SDimitry Andric #elif defined(__clang__)
24*0fca6ea1SDimitry Andric #  define _LIBCPP_COMPILER_CLANG_BASED
25*0fca6ea1SDimitry Andric #  define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
26*0fca6ea1SDimitry Andric #elif defined(__GNUC__)
27*0fca6ea1SDimitry Andric #  define _LIBCPP_COMPILER_GCC
28*0fca6ea1SDimitry Andric #  define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
29*0fca6ea1SDimitry Andric #endif
30*0fca6ea1SDimitry Andric 
31*0fca6ea1SDimitry Andric #ifdef __cplusplus
32*0fca6ea1SDimitry Andric 
33*0fca6ea1SDimitry Andric // Warn if a compiler version is used that is not supported anymore
34*0fca6ea1SDimitry Andric // LLVM RELEASE Update the minimum compiler versions
35*0fca6ea1SDimitry Andric #if defined(_LIBCPP_ENABLE_COMPILER_VERSION_CHECKS) // FreeBSD customization
36*0fca6ea1SDimitry Andric #  if defined(_LIBCPP_CLANG_VER)
37*0fca6ea1SDimitry Andric #    if _LIBCPP_CLANG_VER < 1700
38*0fca6ea1SDimitry Andric #      warning "Libc++ only supports Clang 17 and later"
39*0fca6ea1SDimitry Andric #    endif
40*0fca6ea1SDimitry Andric #  elif defined(_LIBCPP_APPLE_CLANG_VER)
41*0fca6ea1SDimitry Andric #    if _LIBCPP_APPLE_CLANG_VER < 1500
42*0fca6ea1SDimitry Andric #      warning "Libc++ only supports AppleClang 15 and later"
43*0fca6ea1SDimitry Andric #    endif
44*0fca6ea1SDimitry Andric #  elif defined(_LIBCPP_GCC_VER)
45*0fca6ea1SDimitry Andric #    if _LIBCPP_GCC_VER < 1400
46*0fca6ea1SDimitry Andric #      warning "Libc++ only supports GCC 14 and later"
47*0fca6ea1SDimitry Andric #    endif
48*0fca6ea1SDimitry Andric #  endif
49*0fca6ea1SDimitry Andric #endif // _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS
50*0fca6ea1SDimitry Andric 
51*0fca6ea1SDimitry Andric #endif
52*0fca6ea1SDimitry Andric 
53*0fca6ea1SDimitry Andric #endif // _LIBCPP___CONFIGURATION_COMPILER_H
54