Botan 3.7.1
Crypto and TLS for C&
compiler.h
Go to the documentation of this file.
1/*
2* Define useful compiler-specific macros
3* (C) 2016 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_UTIL_COMPILER_FLAGS_H_
9#define BOTAN_UTIL_COMPILER_FLAGS_H_
10
11#include <botan/api.h>
12#include <botan/build.h>
13
15
16/*
17* Define BOTAN_COMPILER_HAS_BUILTIN
18*/
19#if defined(__has_builtin)
20 #define BOTAN_COMPILER_HAS_BUILTIN(x) __has_builtin(x)
21#else
22 #define BOTAN_COMPILER_HAS_BUILTIN(x) 0
23#endif
24
25/*
26* Define BOTAN_COMPILER_HAS_ATTRIBUTE
27*/
28#if defined(__has_attribute)
29 #define BOTAN_COMPILER_HAS_ATTRIBUTE(x) __has_attribute(x)
30 #define BOTAN_COMPILER_ATTRIBUTE(x) __attribute__((x))
31#else
32 #define BOTAN_COMPILER_HAS_ATTRIBUTE(x) 0
33 #define BOTAN_COMPILER_ATTRIBUTE(x) /**/
34#endif
35
36/*
37* Define BOTAN_FUNC_ISA
38*/
39#if BOTAN_COMPILER_HAS_ATTRIBUTE(target)
40 #define BOTAN_FUNC_ISA(isa) BOTAN_COMPILER_ATTRIBUTE(target(isa))
41#else
42 #define BOTAN_FUNC_ISA(isa)
43#endif
44
45/*
46* Define BOTAN_FUNC_ISA_INLINE
47*/
48#define BOTAN_FUNC_ISA_INLINE(isa) BOTAN_FUNC_ISA(isa) BOTAN_FORCE_INLINE
49
50/*
51* Define BOTAN_EARLY_INIT
52*/
53#if BOTAN_COMPILER_HAS_ATTRIBUTE(init_priority)
54 #define BOTAN_EARLY_INIT(prio) BOTAN_COMPILER_ATTRIBUTE(init_priority(prio))
55#else
56 #define BOTAN_EARLY_INIT(prio) /**/
57#endif
58
59/*
60* Define BOTAN_FORCE_INLINE
61*/
62#if !defined(BOTAN_FORCE_INLINE)
63
64 #if BOTAN_COMPILER_HAS_ATTRIBUTE(always_inline)
65 #define BOTAN_FORCE_INLINE inline BOTAN_COMPILER_ATTRIBUTE(always_inline)
66
67 #elif defined(_MSC_VER)
68 #define BOTAN_FORCE_INLINE __forceinline
69
70 #else
71 #define BOTAN_FORCE_INLINE inline
72 #endif
73
74#endif
75
76#endif
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition api.h:84