8#ifndef BOTAN_UTIL_COMPILER_FLAGS_H_
9#define BOTAN_UTIL_COMPILER_FLAGS_H_
12#include <botan/build.h>
21#if defined(__has_builtin)
22 #define BOTAN_COMPILER_HAS_BUILTIN(x) __has_builtin(x)
24 #define BOTAN_COMPILER_HAS_BUILTIN(x) 0
30#if defined(__has_attribute)
31 #define BOTAN_COMPILER_HAS_ATTRIBUTE(x) __has_attribute(x)
32 #define BOTAN_COMPILER_ATTRIBUTE(x) __attribute__((x))
34 #define BOTAN_COMPILER_HAS_ATTRIBUTE(x) 0
35 #define BOTAN_COMPILER_ATTRIBUTE(x)
44#if defined(__GNUC__) && defined(__loongarch64) && (__GNUC__ <= 14)
45 #define BOTAN_COMPILER_DOES_NOT_HAVE_TARGET_ATTRIBUTE
53#if BOTAN_COMPILER_HAS_ATTRIBUTE(target) && !defined(BOTAN_COMPILER_DOES_NOT_HAVE_TARGET_ATTRIBUTE)
54 #define BOTAN_FUNC_ISA(isa) BOTAN_COMPILER_ATTRIBUTE(target(isa))
56 #define BOTAN_FUNC_ISA(isa)
64#define BOTAN_FUNC_ISA_INLINE(isa) BOTAN_FUNC_ISA(isa) BOTAN_FORCE_INLINE
69#if BOTAN_COMPILER_HAS_ATTRIBUTE(init_priority)
70 #define BOTAN_EARLY_INIT(prio) BOTAN_COMPILER_ATTRIBUTE(init_priority(prio))
72 #define BOTAN_EARLY_INIT(prio)
78#if !defined(BOTAN_FORCE_INLINE)
80 #if BOTAN_COMPILER_HAS_ATTRIBUTE(always_inline)
81 #define BOTAN_FORCE_INLINE inline BOTAN_COMPILER_ATTRIBUTE(always_inline)
83 #elif defined(_MSC_VER)
84 #define BOTAN_FORCE_INLINE __forceinline
87 #define BOTAN_FORCE_INLINE inline
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)