xref: /netbsd-src/sys/crypto/sodium/export.h (revision a5b568d2b48c11c3ad18eebbe13a39088222eb4b)
1 
2 #ifndef sodium_export_H
3 #define sodium_export_H
4 
5 #ifndef __GNUC__
6 # ifdef __attribute__
7 #  undef __attribute__
8 # endif
9 # define __attribute__(a)
10 #endif
11 
12 #ifdef SODIUM_STATIC
13 # define SODIUM_EXPORT
14 # define SODIUM_EXPORT_WEAK
15 #else
16 # if defined(_MSC_VER)
17 #  ifdef SODIUM_DLL_EXPORT
18 #   define SODIUM_EXPORT __declspec(dllexport)
19 #  else
20 #   define SODIUM_EXPORT __declspec(dllimport)
21 #  endif
22 # else
23 #  if defined(__SUNPRO_C)
24 #   ifndef __GNU_C__
25 #    define SODIUM_EXPORT __attribute__ (visibility(__global))
26 #   else
27 #    define SODIUM_EXPORT __attribute__ __global
28 #   endif
29 #  elif defined(_MSG_VER)
30 #   define SODIUM_EXPORT extern __declspec(dllexport)
31 #  else
32 #   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
33 #  endif
34 # endif
35 # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
36 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
37 # else
38 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
39 # endif
40 #endif
41 
42 #ifndef CRYPTO_ALIGN
43 # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
44 #  define CRYPTO_ALIGN(x) __declspec(align(x))
45 # else
46 #  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
47 # endif
48 #endif
49 
50 #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
51 #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
52 
53 #endif
54 
55 #ifndef sodium_export_H
56 #define sodium_export_H
57 
58 #ifndef __GNUC__
59 # ifdef __attribute__
60 #  undef __attribute__
61 # endif
62 # define __attribute__(a)
63 #endif
64 
65 #ifdef SODIUM_STATIC
66 # define SODIUM_EXPORT
67 # define SODIUM_EXPORT_WEAK
68 #else
69 # if defined(_MSC_VER)
70 #  ifdef SODIUM_DLL_EXPORT
71 #   define SODIUM_EXPORT __declspec(dllexport)
72 #  else
73 #   define SODIUM_EXPORT __declspec(dllimport)
74 #  endif
75 # else
76 #  if defined(__SUNPRO_C)
77 #   ifndef __GNU_C__
78 #    define SODIUM_EXPORT __attribute__ (visibility(__global))
79 #   else
80 #    define SODIUM_EXPORT __attribute__ __global
81 #   endif
82 #  elif defined(_MSG_VER)
83 #   define SODIUM_EXPORT extern __declspec(dllexport)
84 #  else
85 #   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
86 #  endif
87 # endif
88 # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
89 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
90 # else
91 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
92 # endif
93 #endif
94 
95 #ifndef CRYPTO_ALIGN
96 # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
97 #  define CRYPTO_ALIGN(x) __declspec(align(x))
98 # else
99 #  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
100 # endif
101 #endif
102 
103 #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
104 #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
105 
106 #endif
107 
108 #ifndef sodium_export_H
109 #define sodium_export_H
110 
111 #ifndef __GNUC__
112 # ifdef __attribute__
113 #  undef __attribute__
114 # endif
115 # define __attribute__(a)
116 #endif
117 
118 #ifdef SODIUM_STATIC
119 # define SODIUM_EXPORT
120 # define SODIUM_EXPORT_WEAK
121 #else
122 # if defined(_MSC_VER)
123 #  ifdef SODIUM_DLL_EXPORT
124 #   define SODIUM_EXPORT __declspec(dllexport)
125 #  else
126 #   define SODIUM_EXPORT __declspec(dllimport)
127 #  endif
128 # else
129 #  if defined(__SUNPRO_C)
130 #   ifndef __GNU_C__
131 #    define SODIUM_EXPORT __attribute__ (visibility(__global))
132 #   else
133 #    define SODIUM_EXPORT __attribute__ __global
134 #   endif
135 #  elif defined(_MSG_VER)
136 #   define SODIUM_EXPORT extern __declspec(dllexport)
137 #  else
138 #   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
139 #  endif
140 # endif
141 # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
142 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
143 # else
144 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
145 # endif
146 #endif
147 
148 #ifndef CRYPTO_ALIGN
149 # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
150 #  define CRYPTO_ALIGN(x) __declspec(align(x))
151 # else
152 #  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
153 # endif
154 #endif
155 
156 #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
157 #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
158 
159 #endif
160 
161 #ifndef sodium_export_H
162 #define sodium_export_H
163 
164 #ifndef __GNUC__
165 # ifdef __attribute__
166 #  undef __attribute__
167 # endif
168 # define __attribute__(a)
169 #endif
170 
171 #ifdef SODIUM_STATIC
172 # define SODIUM_EXPORT
173 # define SODIUM_EXPORT_WEAK
174 #else
175 # if defined(_MSC_VER)
176 #  ifdef SODIUM_DLL_EXPORT
177 #   define SODIUM_EXPORT __declspec(dllexport)
178 #  else
179 #   define SODIUM_EXPORT __declspec(dllimport)
180 #  endif
181 # else
182 #  if defined(__SUNPRO_C)
183 #   ifndef __GNU_C__
184 #    define SODIUM_EXPORT __attribute__ (visibility(__global))
185 #   else
186 #    define SODIUM_EXPORT __attribute__ __global
187 #   endif
188 #  elif defined(_MSG_VER)
189 #   define SODIUM_EXPORT extern __declspec(dllexport)
190 #  else
191 #   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
192 #  endif
193 # endif
194 # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
195 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
196 # else
197 #  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
198 # endif
199 #endif
200 
201 #ifndef CRYPTO_ALIGN
202 # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
203 #  define CRYPTO_ALIGN(x) __declspec(align(x))
204 # else
205 #  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
206 # endif
207 #endif
208 
209 #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
210 #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
211 
212 #endif
213