[libc][NFC] Move aligned access implementations to separate header
[llvm-project.git] / libc / src / __support / macros / config.h
blobdcc4a3086fb68a2931ebe88780c85f48cee6a867
1 //===-- Portable attributes -------------------------------------*- C++ -*-===//
2 //
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
6 //
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
16 // LIBC_HAS_BUILTIN()
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
28 #ifdef __has_builtin
29 #define LIBC_HAS_BUILTIN(x) __has_builtin(x)
30 #else
31 #define LIBC_HAS_BUILTIN(x) 0
32 #endif
34 // Compiler feature-detection.
35 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
36 #ifdef __has_feature
37 #define LIBC_HAS_FEATURE(f) __has_feature(f)
38 #else
39 #define LIBC_HAS_FEATURE(f) 0
40 #endif
42 #endif // LLVM_LIBC_SUPPORT_MACROS_CONFIG_H