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 < 1700
37# warning "Libc++ only supports Clang 17 and later"
38# endif
39# elif defined(_LIBCPP_APPLE_CLANG_VER)
40# if _LIBCPP_APPLE_CLANG_VER < 1500
41# warning "Libc++ only supports AppleClang 15 and later"
42# endif
43# elif defined(_LIBCPP_GCC_VER)
44# if _LIBCPP_GCC_VER < 1400
45# warning "Libc++ only supports GCC 14 and later"
46# endif
47# endif
48
49#endif
50
51#endif // _LIBCPP___CONFIGURATION_COMPILER_H
52