Botan 3.7.1
Crypto and TLS for C&
api.h
Go to the documentation of this file.
1/*
2* (C) 2016,2025 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_API_ANNOTATIONS_H_
8#define BOTAN_API_ANNOTATIONS_H_
9
10#include <botan/build.h>
11
12/**
13* Used to annotate API exports which are public and supported.
14* These APIs will not be broken/removed unless strictly required for
15* functionality or security, and only in new major versions.
16* @param maj The major version this public API was released in
17* @param min The minor version this public API was released in
18*/
19#define BOTAN_PUBLIC_API(maj, min) BOTAN_DLL
20
21/**
22* Used to annotate API exports which are public, but are now deprecated
23* and which will be removed in a future major release.
24*/
25#define BOTAN_DEPRECATED_API(msg) BOTAN_DEPRECATED(msg) BOTAN_DLL
26
27/**
28* Used to annotate API exports which are public and can be used by
29* applications if needed, but which are intentionally not documented,
30* and which may change incompatibly in a future major version.
31*/
32#define BOTAN_UNSTABLE_API BOTAN_DLL
33
34/**
35* Used to annotate API exports which are exported but only for the
36* purposes of testing. They should not be used by applications and
37* may be removed or changed without notice.
38*/
39#define BOTAN_TEST_API BOTAN_DLL
40
41/**
42* Used to annotate API exports which are exported but only for the
43* purposes of fuzzing. They should not be used by applications and
44* may be removed or changed without notice.
45*
46* They are only exported if the fuzzers are being built
47*/
48#if defined(BOTAN_FUZZERS_ARE_BEING_BUILT)
49 #define BOTAN_FUZZER_API BOTAN_DLL
50#else
51 #define BOTAN_FUZZER_API
52#endif
53
54/*
55* Define BOTAN_DEPRECATED
56*/
57#if !defined(BOTAN_NO_DEPRECATED_WARNINGS) && !defined(BOTAN_AMALGAMATION_H_) && !defined(BOTAN_IS_BEING_BUILT)
58
59 #define BOTAN_DEPRECATED(msg) [[deprecated(msg)]]
60
61 #if defined(__clang__)
62 #define BOTAN_DEPRECATED_HEADER(hdr) _Pragma("message \"this header is deprecated\"")
63 #define BOTAN_FUTURE_INTERNAL_HEADER(hdr) _Pragma("message \"this header will be made internal in the future\"")
64 #elif defined(_MSC_VER)
65 #define BOTAN_DEPRECATED_HEADER(hdr) __pragma(message("this header is deprecated"))
66 #define BOTAN_FUTURE_INTERNAL_HEADER(hdr) __pragma(message("this header will be made internal in the future"))
67 #elif defined(__GNUC__)
68 #define BOTAN_DEPRECATED_HEADER(hdr) _Pragma("GCC warning \"this header is deprecated\"")
69 #define BOTAN_FUTURE_INTERNAL_HEADER(hdr) \
70 _Pragma("GCC warning \"this header will be made internal in the future\"")
71 #endif
72
73#endif
74
75#if !defined(BOTAN_DEPRECATED)
76 #define BOTAN_DEPRECATED(msg)
77#endif
78
79#if !defined(BOTAN_DEPRECATED_HEADER)
80 #define BOTAN_DEPRECATED_HEADER(hdr)
81#endif
82
83#if !defined(BOTAN_FUTURE_INTERNAL_HEADER)
84 #define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
85#endif
86
87#if defined(__clang__)
88 #define BOTAN_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
89 #define BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \
90 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
91 #define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
92 #define BOTAN_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
93#elif defined(__GNUG__)
94 #define BOTAN_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
95 #define BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \
96 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
97 #define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
98 #define BOTAN_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
99#elif defined(_MSC_VER)
100 #define BOTAN_DIAGNOSTIC_PUSH __pragma(warning(push))
101 #define BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS __pragma(warning(disable : 4996))
102 #define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE __pragma(warning(disable : 4250))
103 #define BOTAN_DIAGNOSTIC_POP __pragma(warning(pop))
104#else
105 #define BOTAN_DIAGNOSTIC_PUSH
106 #define BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS
107 #define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
108 #define BOTAN_DIAGNOSTIC_POP
109#endif
110
111#endif