Line | Count | Source |
1 | | /* |
2 | | * Copyright © 2007,2008,2009 Red Hat, Inc. |
3 | | * Copyright © 2011,2012 Google, Inc. |
4 | | * |
5 | | * This is part of HarfBuzz, a text shaping library. |
6 | | * |
7 | | * Permission is hereby granted, without written agreement and without |
8 | | * license or royalty fees, to use, copy, modify, and distribute this |
9 | | * software and its documentation for any purpose, provided that the |
10 | | * above copyright notice and the following two paragraphs appear in |
11 | | * all copies of this software. |
12 | | * |
13 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
14 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
15 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
16 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
17 | | * DAMAGE. |
18 | | * |
19 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
20 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
21 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
22 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
23 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
24 | | * |
25 | | * Red Hat Author(s): Behdad Esfahbod |
26 | | * Google Author(s): Behdad Esfahbod |
27 | | */ |
28 | | |
29 | | #ifndef HB_HH |
30 | | #define HB_HH |
31 | | |
32 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC |
33 | | #ifdef _MSC_VER |
34 | | #pragma warning( disable: 4068 ) /* Unknown pragma */ |
35 | | #endif |
36 | | #if defined(__GNUC__) || defined(__clang__) |
37 | | /* Rules: |
38 | | * |
39 | | * - All pragmas are declared GCC even if they are clang ones. Otherwise GCC |
40 | | * nags, even though we instruct it to ignore -Wunknown-pragmas. ¯\_(ツ)_/¯ |
41 | | * |
42 | | * - Within each category, keep sorted. |
43 | | * |
44 | | * - Warnings whose scope can be expanded in future compiler versions shall |
45 | | * be declared as "warning". Otherwise, either ignored or error. |
46 | | */ |
47 | | |
48 | | /* Setup. Don't sort order within this category. */ |
49 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING |
50 | | #pragma GCC diagnostic warning "-Wall" |
51 | | #pragma GCC diagnostic warning "-Wextra" |
52 | | #endif |
53 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED |
54 | | #pragma GCC diagnostic ignored "-Wpragmas" |
55 | | #pragma GCC diagnostic ignored "-Wunknown-pragmas" |
56 | | #pragma GCC diagnostic ignored "-Wunknown-warning-option" |
57 | | #endif |
58 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING |
59 | | //#pragma GCC diagnostic warning "-Weverything" |
60 | | #endif |
61 | | |
62 | | /* Error. Should never happen. */ |
63 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR |
64 | | #pragma GCC diagnostic error "-Wbitwise-instead-of-logical" |
65 | | #pragma GCC diagnostic error "-Wcast-align" |
66 | | #pragma GCC diagnostic error "-Wcast-function-type" |
67 | | #pragma GCC diagnostic error "-Wcomma" |
68 | | #pragma GCC diagnostic error "-Wdelete-non-virtual-dtor" |
69 | | #pragma GCC diagnostic error "-Wembedded-directive" |
70 | | #pragma GCC diagnostic error "-Wextra-semi-stmt" |
71 | | #pragma GCC diagnostic error "-Wformat-security" |
72 | | #pragma GCC diagnostic error "-Wimplicit-function-declaration" |
73 | | #pragma GCC diagnostic error "-Winit-self" |
74 | | #pragma GCC diagnostic error "-Winjected-class-name" |
75 | | #pragma GCC diagnostic error "-Wmissing-braces" |
76 | | #pragma GCC diagnostic error "-Wmissing-declarations" |
77 | | #pragma GCC diagnostic error "-Wmissing-prototypes" |
78 | | #pragma GCC diagnostic error "-Wnarrowing" |
79 | | #pragma GCC diagnostic error "-Wnested-externs" |
80 | | #pragma GCC diagnostic error "-Wold-style-definition" |
81 | | #pragma GCC diagnostic error "-Wpointer-arith" |
82 | | #pragma GCC diagnostic error "-Wredundant-decls" |
83 | | #pragma GCC diagnostic error "-Wreorder" |
84 | | #pragma GCC diagnostic error "-Wsign-compare" |
85 | | #pragma GCC diagnostic error "-Wstrict-prototypes" |
86 | | #pragma GCC diagnostic error "-Wstring-conversion" |
87 | | #pragma GCC diagnostic error "-Wswitch-enum" |
88 | | #pragma GCC diagnostic error "-Wtautological-overlap-compare" |
89 | | #pragma GCC diagnostic error "-Wunneeded-internal-declaration" |
90 | | #pragma GCC diagnostic error "-Wunused" |
91 | | #pragma GCC diagnostic error "-Wunused-local-typedefs" |
92 | | #pragma GCC diagnostic error "-Wunused-value" |
93 | | #pragma GCC diagnostic error "-Wunused-variable" |
94 | | #pragma GCC diagnostic error "-Wvla" |
95 | | #pragma GCC diagnostic error "-Wwrite-strings" |
96 | | #endif |
97 | | |
98 | | /* Warning. To be investigated if happens. */ |
99 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING |
100 | | #pragma GCC diagnostic warning "-Wbuiltin-macro-redefined" |
101 | | #pragma GCC diagnostic warning "-Wdeprecated" |
102 | | #pragma GCC diagnostic warning "-Wdeprecated-declarations" |
103 | | #pragma GCC diagnostic warning "-Wdisabled-optimization" |
104 | | #pragma GCC diagnostic warning "-Wdouble-promotion" |
105 | | #pragma GCC diagnostic warning "-Wformat=2" |
106 | | #pragma GCC diagnostic warning "-Wformat-signedness" |
107 | | #pragma GCC diagnostic warning "-Wignored-pragma-optimize" |
108 | | #pragma GCC diagnostic warning "-Wlogical-op" |
109 | | #pragma GCC diagnostic warning "-Wmaybe-uninitialized" |
110 | | #pragma GCC diagnostic warning "-Wmissing-format-attribute" |
111 | | #pragma GCC diagnostic warning "-Wundef" |
112 | | #pragma GCC diagnostic warning "-Wunsafe-loop-optimizations" |
113 | | #pragma GCC diagnostic warning "-Wunused-but-set-variable" |
114 | | #endif |
115 | | |
116 | | /* Ignored currently, but should be fixed at some point. */ |
117 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED |
118 | | #pragma GCC diagnostic ignored "-Wconversion" // TODO fix |
119 | | #pragma GCC diagnostic ignored "-Wshadow" // TODO fix |
120 | | #pragma GCC diagnostic ignored "-Wunused-parameter" // TODO fix |
121 | | #if defined(__GNUC__) && !defined(__clang__) |
122 | | #pragma GCC diagnostic ignored "-Wunused-result" // TODO fix |
123 | | #endif |
124 | | #endif |
125 | | |
126 | | /* Ignored intentionally. */ |
127 | | #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED |
128 | | #pragma GCC diagnostic ignored "-Wclass-memaccess" |
129 | | #pragma GCC diagnostic ignored "-Wcast-function-type-strict" // https://github.com/harfbuzz/harfbuzz/pull/3859#issuecomment-1295409126 |
130 | | #pragma GCC diagnostic ignored "-Wdangling-reference" // https://github.com/harfbuzz/harfbuzz/issues/4043 |
131 | | #pragma GCC diagnostic ignored "-Wformat-nonliteral" |
132 | | #pragma GCC diagnostic ignored "-Wformat-zero-length" |
133 | | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
134 | | #pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang |
135 | | #pragma GCC diagnostic ignored "-Wrange-loop-analysis" // https://github.com/harfbuzz/harfbuzz/issues/2834 |
136 | | #pragma GCC diagnostic ignored "-Wstrict-aliasing" |
137 | | #pragma GCC diagnostic ignored "-Wtype-limits" |
138 | | #pragma GCC diagnostic ignored "-Wc++11-compat" // only gcc raises it |
139 | | #endif |
140 | | |
141 | | #endif |
142 | | #endif |
143 | | |
144 | | |
145 | | #include "hb-config.hh" |
146 | | #include "hb-limits.hh" |
147 | | |
148 | | |
149 | | /* |
150 | | * Following added based on what AC_USE_SYSTEM_EXTENSIONS adds to |
151 | | * config.h.in. Copied here for the convenience of those embedding |
152 | | * HarfBuzz and not using our build system. |
153 | | */ |
154 | | /* Enable extensions on AIX 3, Interix. */ |
155 | | #ifndef _ALL_SOURCE |
156 | | # define _ALL_SOURCE 1 |
157 | | #endif |
158 | | /* Enable GNU extensions on systems that have them. */ |
159 | | #ifndef _GNU_SOURCE |
160 | | # define _GNU_SOURCE 1 |
161 | | #endif |
162 | | /* Enable threading extensions on Solaris. */ |
163 | | #ifndef _POSIX_PTHREAD_SEMANTICS |
164 | | # define _POSIX_PTHREAD_SEMANTICS 1 |
165 | | #endif |
166 | | /* Enable extensions on HP NonStop. */ |
167 | | #ifndef _TANDEM_SOURCE |
168 | | # define _TANDEM_SOURCE 1 |
169 | | #endif |
170 | | /* Enable general extensions on Solaris. */ |
171 | | #ifndef __EXTENSIONS__ |
172 | | # define __EXTENSIONS__ 1 |
173 | | #endif |
174 | | |
175 | | #if defined (_MSC_VER) && defined (HB_DLL_EXPORT) |
176 | | #define HB_EXTERN __declspec (dllexport) extern |
177 | | #endif |
178 | | |
179 | | #include "hb.h" |
180 | | #define HB_H_IN |
181 | | #include "hb-ot.h" |
182 | | #define HB_OT_H_IN |
183 | | #include "hb-aat.h" |
184 | | #define HB_AAT_H_IN |
185 | | |
186 | | #include <cassert> |
187 | | #include <cfloat> |
188 | | #include <climits> |
189 | | #if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) |
190 | | # define _USE_MATH_DEFINES |
191 | | #endif |
192 | | #include <cmath> |
193 | | #include <cstdarg> |
194 | | #include <cstddef> |
195 | | #include <cstdio> |
196 | | #include <cstdlib> |
197 | | #include <cstring> |
198 | | |
199 | | #if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__) |
200 | | #ifdef __MINGW32_VERSION |
201 | | #ifndef WIN32_LEAN_AND_MEAN |
202 | | #define WIN32_LEAN_AND_MEAN 1 |
203 | | #endif |
204 | | #else |
205 | | #include <intrin.h> |
206 | | #endif |
207 | | #endif |
208 | | |
209 | | #ifdef _WIN32 |
210 | | #include <windows.h> |
211 | | #include <winapifamily.h> |
212 | | #endif |
213 | | |
214 | 66.5M | #define HB_PASTE1(a,b) a##b |
215 | 66.5M | #define HB_PASTE(a,b) HB_PASTE1(a,b) |
216 | | |
217 | | |
218 | | /* Compile-time custom allocator support. */ |
219 | | |
220 | | #if !defined(HB_CUSTOM_MALLOC) \ |
221 | | && defined(hb_malloc_impl) \ |
222 | | && defined(hb_calloc_impl) \ |
223 | | && defined(hb_realloc_impl) \ |
224 | | && defined(hb_free_impl) |
225 | | #define HB_CUSTOM_MALLOC |
226 | | #endif |
227 | | |
228 | | #ifdef HB_CUSTOM_MALLOC |
229 | | extern "C" void* hb_malloc_impl(size_t size); |
230 | | extern "C" void* hb_calloc_impl(size_t nmemb, size_t size); |
231 | | extern "C" void* hb_realloc_impl(void *ptr, size_t size); |
232 | | extern "C" void hb_free_impl(void *ptr); |
233 | 14.6M | #define hb_malloc hb_malloc_impl |
234 | 221M | #define hb_calloc hb_calloc_impl |
235 | 133M | #define hb_realloc hb_realloc_impl |
236 | 863M | #define hb_free hb_free_impl |
237 | | #else |
238 | | #define hb_malloc malloc |
239 | | #define hb_calloc calloc |
240 | | #define hb_realloc realloc |
241 | | #define hb_free free |
242 | | #endif |
243 | | |
244 | | |
245 | | /* |
246 | | * Compiler attributes |
247 | | */ |
248 | | |
249 | | #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) |
250 | 43.2G | #define likely(expr) (__builtin_expect (!!(expr), 1)) |
251 | 123G | #define unlikely(expr) (__builtin_expect (!!(expr), 0)) |
252 | | #else |
253 | | #define likely(expr) (expr) |
254 | | #define unlikely(expr) (expr) |
255 | | #endif |
256 | | |
257 | | #if !defined(__GNUC__) && !defined(__clang__) |
258 | | #undef __attribute__ |
259 | | #define __attribute__(x) |
260 | | #endif |
261 | | |
262 | | #if defined(__GNUC__) && (__GNUC__ >= 3) |
263 | | #define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx))) |
264 | | #else |
265 | | #define HB_PRINTF_FUNC(format_idx, arg_idx) |
266 | | #endif |
267 | | #if defined(__GNUC__) && (__GNUC__ >= 4) || (__clang__) |
268 | 668M | #define HB_UNUSED __attribute__((unused)) |
269 | | #elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */ |
270 | | #define HB_UNUSED __pragma(warning(suppress: 4100 4101)) |
271 | | #else |
272 | | #define HB_UNUSED |
273 | | #endif |
274 | | |
275 | | #ifndef HB_INTERNAL |
276 | | # if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC) |
277 | | # define HB_INTERNAL __attribute__((__visibility__("hidden"))) |
278 | | # elif defined(__MINGW32__) |
279 | | /* We use -export-symbols on mingw32, since it does not support visibility attributes. */ |
280 | | # define HB_INTERNAL |
281 | | # elif defined (_MSC_VER) && defined (HB_DLL_EXPORT) |
282 | | /* We do not try to export internal symbols on Visual Studio */ |
283 | | # define HB_INTERNAL |
284 | | #else |
285 | | # define HB_INTERNAL |
286 | | # define HB_NO_VISIBILITY 1 |
287 | | # endif |
288 | | #endif |
289 | | |
290 | | /* https://github.com/harfbuzz/harfbuzz/issues/1651 */ |
291 | | #if defined(__clang__) && __clang_major__ < 10 |
292 | | #define static_const static |
293 | | #else |
294 | | #define static_const static const |
295 | | #endif |
296 | | |
297 | | #if defined(__GNUC__) && (__GNUC__ >= 3) |
298 | 32.5G | #define HB_FUNC __PRETTY_FUNCTION__ |
299 | | #elif defined(_MSC_VER) |
300 | | #define HB_FUNC __FUNCSIG__ |
301 | | #else |
302 | | #define HB_FUNC __func__ |
303 | | #endif |
304 | | |
305 | | #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140) |
306 | | /* https://github.com/harfbuzz/harfbuzz/issues/630 */ |
307 | | #define __restrict |
308 | | #endif |
309 | | |
310 | | /* |
311 | | * Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411 |
312 | | * HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch |
313 | | * cases that fall through without a break or return statement. HB_FALLTHROUGH |
314 | | * is only needed on cases that have code: |
315 | | * |
316 | | * switch (foo) { |
317 | | * case 1: // These cases have no code. No fallthrough annotations are needed. |
318 | | * case 2: |
319 | | * case 3: |
320 | | * foo = 4; // This case has code, so a fallthrough annotation is needed: |
321 | | * HB_FALLTHROUGH; |
322 | | * default: |
323 | | * return foo; |
324 | | * } |
325 | | */ |
326 | | #if defined(__clang__) && __cplusplus >= 201103L |
327 | | /* clang's fallthrough annotations are only available starting in C++11. */ |
328 | 580k | # define HB_FALLTHROUGH [[clang::fallthrough]] |
329 | | #elif defined(__GNUC__) && (__GNUC__ >= 7) |
330 | | /* GNU fallthrough attribute is available from GCC7 */ |
331 | | # define HB_FALLTHROUGH __attribute__((fallthrough)) |
332 | | #elif defined(_MSC_VER) |
333 | | /* |
334 | | * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis): |
335 | | * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx |
336 | | */ |
337 | | # include <sal.h> |
338 | | # define HB_FALLTHROUGH __fallthrough |
339 | | #else |
340 | | # define HB_FALLTHROUGH /* FALLTHROUGH */ |
341 | | #endif |
342 | | |
343 | | /* A tag to enforce use of return value for a function */ |
344 | | #if __cplusplus >= 201703L |
345 | | # define HB_NODISCARD [[nodiscard]] |
346 | | #elif defined(__GNUC__) || defined(__clang__) |
347 | | # define HB_NODISCARD __attribute__((warn_unused_result)) |
348 | | #elif defined(_MSC_VER) |
349 | | # define HB_NODISCARD _Check_return_ |
350 | | #else |
351 | | # define HB_NODISCARD |
352 | | #endif |
353 | | |
354 | | /* https://github.com/harfbuzz/harfbuzz/issues/1852 */ |
355 | | #if defined(__clang__) && !(defined(_AIX) && (defined(__IBMCPP__) || defined(__ibmxl__))) |
356 | | /* Disable certain sanitizer errors. */ |
357 | | /* https://github.com/harfbuzz/harfbuzz/issues/1247 */ |
358 | | #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW __attribute__((no_sanitize("signed-integer-overflow"))) |
359 | | #else |
360 | | #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW |
361 | | #endif |
362 | | |
363 | | |
364 | | #ifdef _WIN32 |
365 | | /* We need Windows Vista for both Uniscribe backend and for |
366 | | * MemoryBarrier. We don't support compiling on Windows XP, |
367 | | * though we run on it fine. */ |
368 | | # if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 |
369 | | # undef _WIN32_WINNT |
370 | | # endif |
371 | | # ifndef _WIN32_WINNT |
372 | | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |
373 | | # define _WIN32_WINNT 0x0600 |
374 | | # endif |
375 | | # endif |
376 | | # ifndef WIN32_LEAN_AND_MEAN |
377 | | # define WIN32_LEAN_AND_MEAN 1 |
378 | | # endif |
379 | | # ifndef STRICT |
380 | | # define STRICT 1 |
381 | | # endif |
382 | | |
383 | | # if defined(_WIN32_WCE) |
384 | | /* Some things not defined on Windows CE. */ |
385 | | # define vsnprintf _vsnprintf |
386 | | # ifndef HB_NO_GETENV |
387 | | # define HB_NO_GETENV |
388 | | # endif |
389 | | # if _WIN32_WCE < 0x800 |
390 | | # define HB_NO_SETLOCALE |
391 | | # define HB_NO_ERRNO |
392 | | # endif |
393 | | # elif !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |
394 | | # ifndef HB_NO_GETENV |
395 | | # define HB_NO_GETENV |
396 | | # endif |
397 | | # endif |
398 | | # if defined(_MSC_VER) && _MSC_VER < 1900 |
399 | | # define snprintf _snprintf |
400 | | # endif |
401 | | #endif |
402 | | |
403 | | #ifdef HB_NO_GETENV |
404 | | #define getenv(Name) nullptr |
405 | | #endif |
406 | | |
407 | | #ifndef HB_NO_ERRNO |
408 | | # include <cerrno> |
409 | | #else |
410 | | static int HB_UNUSED _hb_errno = 0; |
411 | | # undef errno |
412 | | # define errno _hb_errno |
413 | | #endif |
414 | | |
415 | 233M | #define HB_STMT_START do |
416 | 233M | #define HB_STMT_END while (0) |
417 | | |
418 | | #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT) |
419 | | /* atexit() is only safe to be called from shared libraries on certain |
420 | | * platforms. Whitelist. |
421 | | * https://bugs.freedesktop.org/show_bug.cgi?id=82246 */ |
422 | | # if defined(__linux) && defined(__GLIBC_PREREQ) |
423 | | # if __GLIBC_PREREQ(2,3) |
424 | | /* From atexit() manpage, it's safe with glibc 2.2.3 on Linux. */ |
425 | | # define HB_USE_ATEXIT 1 |
426 | | # endif |
427 | | # elif defined(_MSC_VER) || defined(__MINGW32__) |
428 | | /* For MSVC: |
429 | | * https://msdn.microsoft.com/en-us/library/tze57ck3.aspx |
430 | | * https://msdn.microsoft.com/en-us/library/zk17ww08.aspx |
431 | | * mingw32 headers say atexit is safe to use in shared libraries. |
432 | | */ |
433 | | # define HB_USE_ATEXIT 1 |
434 | | # elif defined(__ANDROID__) |
435 | | /* This is available since Android NKD r8 or r8b: |
436 | | * https://issuetracker.google.com/code/p/android/issues/detail?id=6455 |
437 | | */ |
438 | | # define HB_USE_ATEXIT 1 |
439 | | # elif defined(__APPLE__) |
440 | | /* For macOS and related platforms, the atexit man page indicates |
441 | | * that it will be invoked when the library is unloaded, not only |
442 | | * at application exit. |
443 | | */ |
444 | | # define HB_USE_ATEXIT 1 |
445 | | # endif |
446 | | #endif /* defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT) */ |
447 | | #ifdef HB_NO_ATEXIT |
448 | | # undef HB_USE_ATEXIT |
449 | | #endif |
450 | | #ifndef HB_USE_ATEXIT |
451 | | # define HB_USE_ATEXIT 0 |
452 | | #endif |
453 | | #ifndef hb_atexit |
454 | | #if !HB_USE_ATEXIT |
455 | | # define hb_atexit(_) HB_STMT_START { if (0) (_) (); } HB_STMT_END |
456 | | #else /* HB_USE_ATEXIT */ |
457 | | # ifdef HAVE_ATEXIT |
458 | 7.06k | # define hb_atexit atexit |
459 | | # else |
460 | | template <void (*function) (void)> struct hb_atexit_t { ~hb_atexit_t () { function (); } }; |
461 | | # define hb_atexit(f) static hb_atexit_t<f> _hb_atexit_##__LINE__; |
462 | | # endif |
463 | | #endif |
464 | | #endif |
465 | | |
466 | | /* Lets assert int types. Saves trouble down the road. */ |
467 | | static_assert ((sizeof (hb_codepoint_t) == 4), ""); |
468 | | static_assert ((sizeof (hb_position_t) == 4), ""); |
469 | | static_assert ((sizeof (hb_mask_t) == 4), ""); |
470 | | static_assert ((sizeof (hb_var_int_t) == 4), ""); |
471 | | |
472 | | |
473 | | /* Headers we include for everyone. Keep topologically sorted by dependency. |
474 | | * They express dependency amongst themselves, but no other file should include |
475 | | * them directly.*/ |
476 | | #include "hb-cplusplus.hh" |
477 | | #include "hb-meta.hh" |
478 | | #include "hb-mutex.hh" |
479 | | #include "hb-number.hh" |
480 | | #include "hb-atomic.hh" // Requires: hb-meta |
481 | | #include "hb-null.hh" // Requires: hb-meta |
482 | | #include "hb-algs.hh" // Requires: hb-meta hb-null hb-number |
483 | | #include "hb-iter.hh" // Requires: hb-algs hb-meta |
484 | | #include "hb-debug.hh" // Requires: hb-algs hb-atomic |
485 | | #include "hb-array.hh" // Requires: hb-algs hb-iter hb-null |
486 | | #include "hb-vector.hh" // Requires: hb-array hb-null |
487 | | #include "hb-object.hh" // Requires: hb-atomic hb-mutex hb-vector |
488 | | |
489 | | #endif /* HB_HH */ |