1 //===-- Portable attributes -------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 // This header file defines a set of macros for checking the presence of
9 // important compiler and platform features. Such macros can be used to
10 // produce portable code by parameterizing compilation based on the presence or
11 // lack of a given feature.
13 #ifndef LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
14 #define LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
18 // Checks whether the compiler supports a Clang Feature Checking Macro, and if
19 // so, checks whether it supports the provided builtin function "x" where x
20 // is one of the functions noted in
21 // https://clang.llvm.org/docs/LanguageExtensions.html
23 // Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
24 // http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
26 // Compiler builtin-detection.
27 // clang.llvm.org/docs/LanguageExtensions.html#has-builtin
29 #define LIBC_HAS_BUILTIN(x) __has_builtin(x)
31 #define LIBC_HAS_BUILTIN(x) 0
34 // Compiler feature-detection.
35 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
37 #define LIBC_HAS_FEATURE(f) __has_feature(f)
39 #define LIBC_HAS_FEATURE(f) 0
42 #endif // LLVM_LIBC_SUPPORT_MACROS_CONFIG_H