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 macros for declaring attributes for functions, 9 // types, and variables. 10 // 11 // These macros are used within llvm-libc and allow the compiler to optimize, 12 // where applicable, certain function calls. 13 // 14 // Most macros here are exposing GCC or Clang features, and are stubbed out for 15 // other compilers. 16 17 #ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H 18 #define LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H 19 20 #include "properties/architectures.h" 21 22 #define LIBC_INLINE inline 23 #define LIBC_INLINE_VAR inline 24 #define LIBC_INLINE_ASM __asm__ __volatile__ 25 #define LIBC_UNUSED __attribute__((unused)) 26 27 #ifdef LIBC_TARGET_ARCH_IS_GPU 28 #define LIBC_THREAD_LOCAL 29 #else 30 #define LIBC_THREAD_LOCAL thread_local 31 #endif 32 33 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H 34