2 * Copyright © 2007,2008,2009 Red Hat, Inc.
3 * Copyright © 2011,2012 Google, Inc.
5 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
25 * Red Hat Author(s): Behdad Esfahbod
26 * Google Author(s): Behdad Esfahbod
32 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC
34 #pragma warning( disable: 4068 ) /* Unknown pragma */
36 #if defined(__GNUC__) || defined(__clang__)
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. ¯\_(ツ)_/¯
42 * - Within each category, keep sorted.
44 * - Warnings whose scope can be expanded in future compiler versions shall
45 * be declared as "warning". Otherwise, either ignored or error.
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"
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"
58 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING
59 //#pragma GCC diagnostic warning "-Weverything"
62 /* Error. Should never happen. */
63 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR
64 #pragma GCC diagnostic error "-Wc++11-narrowing"
65 #pragma GCC diagnostic error "-Wcast-align"
66 #pragma GCC diagnostic error "-Wcast-function-type"
67 #pragma GCC diagnostic error "-Wdelete-non-virtual-dtor"
68 #pragma GCC diagnostic error "-Wformat-security"
69 #pragma GCC diagnostic error "-Wimplicit-function-declaration"
70 #pragma GCC diagnostic error "-Winit-self"
71 #pragma GCC diagnostic error "-Wmissing-braces"
72 #pragma GCC diagnostic error "-Wmissing-declarations"
73 #pragma GCC diagnostic error "-Wmissing-prototypes"
74 #pragma GCC diagnostic error "-Wnested-externs"
75 #pragma GCC diagnostic error "-Wold-style-definition"
76 #pragma GCC diagnostic error "-Wpointer-arith"
77 #pragma GCC diagnostic error "-Wredundant-decls"
78 #pragma GCC diagnostic error "-Wreorder"
79 #pragma GCC diagnostic error "-Wsign-compare"
80 #pragma GCC diagnostic error "-Wstrict-prototypes"
81 #pragma GCC diagnostic error "-Wstring-conversion"
82 #pragma GCC diagnostic error "-Wswitch-enum"
83 #pragma GCC diagnostic error "-Wtautological-overlap-compare"
84 #pragma GCC diagnostic error "-Wunneeded-internal-declaration"
85 #pragma GCC diagnostic error "-Wunused"
86 #pragma GCC diagnostic error "-Wunused-local-typedefs"
87 #pragma GCC diagnostic error "-Wunused-value"
88 #pragma GCC diagnostic error "-Wunused-variable"
89 #pragma GCC diagnostic error "-Wvla"
90 #pragma GCC diagnostic error "-Wwrite-strings"
93 /* Warning. To be investigated if happens. */
94 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING
95 #pragma GCC diagnostic warning "-Wbuiltin-macro-redefined"
96 #pragma GCC diagnostic warning "-Wdisabled-optimization"
97 #pragma GCC diagnostic warning "-Wformat=2"
98 #pragma GCC diagnostic warning "-Wignored-pragma-optimize"
99 #pragma GCC diagnostic warning "-Wlogical-op"
100 #pragma GCC diagnostic warning "-Wmaybe-uninitialized"
101 #pragma GCC diagnostic warning "-Wmissing-format-attribute"
102 #pragma GCC diagnostic warning "-Wundef"
105 /* Ignored currently, but should be fixed at some point. */
106 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
107 #pragma GCC diagnostic ignored "-Wconversion" // TODO fix
108 #pragma GCC diagnostic ignored "-Wformat-signedness" // TODO fix
109 #pragma GCC diagnostic ignored "-Wshadow" // TODO fix
110 #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" // TODO fix
111 #pragma GCC diagnostic ignored "-Wunused-parameter" // TODO fix
114 /* Ignored intentionally. */
115 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
116 #pragma GCC diagnostic ignored "-Wclass-memaccess"
117 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
118 #pragma GCC diagnostic ignored "-Wformat-zero-length"
119 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
120 #pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang
121 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
122 #pragma GCC diagnostic ignored "-Wtype-limits"
133 * Following added based on what AC_USE_SYSTEM_EXTENSIONS adds to
134 * config.h.in. Copied here for the convenience of those embedding
135 * HarfBuzz and not using our build system.
137 /* Enable extensions on AIX 3, Interix. */
139 # define _ALL_SOURCE 1
141 /* Enable GNU extensions on systems that have them. */
143 # define _GNU_SOURCE 1
145 /* Enable threading extensions on Solaris. */
146 #ifndef _POSIX_PTHREAD_SEMANTICS
147 # define _POSIX_PTHREAD_SEMANTICS 1
149 /* Enable extensions on HP NonStop. */
150 #ifndef _TANDEM_SOURCE
151 # define _TANDEM_SOURCE 1
153 /* Enable general extensions on Solaris. */
154 #ifndef __EXTENSIONS__
155 # define __EXTENSIONS__ 1
158 #if defined (_MSC_VER) && defined (HB_DLL_EXPORT)
159 #define HB_EXTERN __declspec (dllexport) extern
180 #if (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__MINGW32__)
184 #define HB_PASTE1(a,b) a##b
185 #define HB_PASTE(a,b) HB_PASTE1(a,b)
188 /* Compile-time custom allocator support. */
190 #if defined(hb_malloc_impl) \
191 && defined(hb_calloc_impl) \
192 && defined(hb_realloc_impl) \
193 && defined(hb_free_impl)
194 extern "C" void* hb_malloc_impl(size_t size);
195 extern "C" void* hb_calloc_impl(size_t nmemb, size_t size);
196 extern "C" void* hb_realloc_impl(void *ptr, size_t size);
197 extern "C" void hb_free_impl(void *ptr);
198 #define malloc hb_malloc_impl
199 #define calloc hb_calloc_impl
200 #define realloc hb_realloc_impl
201 #define free hb_free_impl
203 #if defined(hb_memalign_impl)
204 extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
205 #define posix_memalign hb_memalign_impl
207 #undef HAVE_POSIX_MEMALIGN
214 * Compiler attributes
217 /* https://github.com/harfbuzz/harfbuzz/issues/1634 */
218 #if __cplusplus < 201103L && !defined(_MSC_VER)
225 #define constexpr const
228 #ifndef static_assert
229 #define static_assert(e, msg) \
230 HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
231 #endif // static_assert
233 #if defined(__GNUC__)
234 #if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
235 #define thread_local __thread
241 template <typename T>
249 static constexpr size_t value = offsetof (s, t);
252 #define alignof(x) (_hb_alignof<x>::value)
255 /* https://github.com/harfbuzz/harfbuzz/issues/1127 */
256 #ifndef explicit_operator
257 #define explicit_operator operator
260 #else /* __cplusplus >= 201103L */
262 /* https://github.com/harfbuzz/harfbuzz/issues/1127 */
263 #ifndef explicit_operator
264 #define explicit_operator explicit operator
267 #endif /* __cplusplus < 201103L */
270 #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
271 #define likely(expr) (__builtin_expect (!!(expr), 1))
272 #define unlikely(expr) (__builtin_expect (!!(expr), 0))
274 #define likely(expr) (expr)
275 #define unlikely(expr) (expr)
278 #if !defined(__GNUC__) && !defined(__clang__)
280 #define __attribute__(x)
283 #if defined(__GNUC__) && (__GNUC__ >= 3)
284 #define HB_PURE_FUNC __attribute__((pure))
285 #define HB_CONST_FUNC __attribute__((const))
286 #define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
289 #define HB_CONST_FUNC
290 #define HB_PRINTF_FUNC(format_idx, arg_idx)
292 #if defined(__GNUC__) && (__GNUC__ >= 4)
293 #define HB_UNUSED __attribute__((unused))
294 #elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */
295 #define HB_UNUSED __pragma(warning(suppress: 4100 4101))
301 # if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC)
302 # define HB_INTERNAL __attribute__((__visibility__("hidden")))
303 # elif defined(__MINGW32__)
304 /* We use -export-symbols on mingw32, since it does not support visibility attributes. */
306 # elif defined (_MSC_VER) && defined (HB_DLL_EXPORT)
307 /* We do not try to export internal symbols on Visual Studio */
311 # define HB_NO_VISIBILITY 1
315 #if defined(__GNUC__) && (__GNUC__ >= 3)
316 #define HB_FUNC __PRETTY_FUNCTION__
317 #elif defined(_MSC_VER)
318 #define HB_FUNC __FUNCSIG__
320 #define HB_FUNC __func__
323 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
324 /* https://github.com/harfbuzz/harfbuzz/issues/630 */
329 * Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411
330 * HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch
331 * cases that fall through without a break or return statement. HB_FALLTHROUGH
332 * is only needed on cases that have code:
335 * case 1: // These cases have no code. No fallthrough annotations are needed.
338 * foo = 4; // This case has code, so a fallthrough annotation is needed:
344 #if defined(__clang__) && __cplusplus >= 201103L
345 /* clang's fallthrough annotations are only available starting in C++11. */
346 # define HB_FALLTHROUGH [[clang::fallthrough]]
347 #elif defined(__GNUC__) && (__GNUC__ >= 7)
348 /* GNU fallthrough attribute is available from GCC7 */
349 # define HB_FALLTHROUGH __attribute__((fallthrough))
350 #elif defined(_MSC_VER)
352 * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
353 * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx
356 # define HB_FALLTHROUGH __fallthrough
358 # define HB_FALLTHROUGH /* FALLTHROUGH */
361 #if defined(__clang__)
362 /* Disable certain sanitizer errors. */
363 /* https://github.com/harfbuzz/harfbuzz/issues/1247 */
364 #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW __attribute__((no_sanitize("signed-integer-overflow")))
366 #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW
371 /* We need Windows Vista for both Uniscribe backend and for
372 * MemoryBarrier. We don't support compiling on Windows XP,
373 * though we run on it fine. */
374 # if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
377 # ifndef _WIN32_WINNT
378 # if !defined(WINAPI_FAMILY) || !(WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
379 # define _WIN32_WINNT 0x0600
382 # ifndef WIN32_LEAN_AND_MEAN
383 # define WIN32_LEAN_AND_MEAN 1
389 # if defined(_WIN32_WCE)
390 /* Some things not defined on Windows CE. */
391 # define vsnprintf _vsnprintf
392 # define getenv(Name) nullptr
393 # if _WIN32_WCE < 0x800
394 # define setlocale(Category, Locale) "C"
395 static int errno = 0; /* Use something better? */
397 # elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
398 # define getenv(Name) nullptr
400 # if defined(_MSC_VER) && _MSC_VER < 1900
401 # define snprintf _snprintf
405 #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT)
406 /* atexit() is only safe to be called from shared libraries on certain
407 * platforms. Whitelist.
408 * https://bugs.freedesktop.org/show_bug.cgi?id=82246 */
409 # if defined(__linux) && defined(__GLIBC_PREREQ)
410 # if __GLIBC_PREREQ(2,3)
411 /* From atexit() manpage, it's safe with glibc 2.2.3 on Linux. */
412 # define HB_USE_ATEXIT 1
414 # elif defined(_MSC_VER) || defined(__MINGW32__)
416 * https://msdn.microsoft.com/en-us/library/tze57ck3.aspx
417 * https://msdn.microsoft.com/en-us/library/zk17ww08.aspx
418 * mingw32 headers say atexit is safe to use in shared libraries.
420 # define HB_USE_ATEXIT 1
421 # elif defined(__ANDROID__)
422 /* This is available since Android NKD r8 or r8b:
423 * https://issuetracker.google.com/code/p/android/issues/detail?id=6455
425 # define HB_USE_ATEXIT 1
426 # elif defined(__APPLE__)
427 /* For macOS and related platforms, the atexit man page indicates
428 * that it will be invoked when the library is unloaded, not only
429 * at application exit.
431 # define HB_USE_ATEXIT 1
435 # undef HB_USE_ATEXIT
437 #ifndef HB_USE_ATEXIT
438 # define HB_USE_ATEXIT 0
441 #define HB_STMT_START do
442 #define HB_STMT_END while (0)
444 /* Static-assert as expression. */
445 template <unsigned int cond> class hb_assert_constant_t;
446 template <> class hb_assert_constant_t<1> {};
447 #define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
449 /* Lets assert int types. Saves trouble down the road. */
450 static_assert ((sizeof (int8_t) == 1), "");
451 static_assert ((sizeof (uint8_t) == 1), "");
452 static_assert ((sizeof (int16_t) == 2), "");
453 static_assert ((sizeof (uint16_t) == 2), "");
454 static_assert ((sizeof (int32_t) == 4), "");
455 static_assert ((sizeof (uint32_t) == 4), "");
456 static_assert ((sizeof (int64_t) == 8), "");
457 static_assert ((sizeof (uint64_t) == 8), "");
458 static_assert ((sizeof (hb_codepoint_t) == 4), "");
459 static_assert ((sizeof (hb_position_t) == 4), "");
460 static_assert ((sizeof (hb_mask_t) == 4), "");
461 static_assert ((sizeof (hb_var_int_t) == 4), "");
464 #if __cplusplus >= 201103L
466 /* We only enable these with C++11 or later, since earlier language
467 * does not allow structs with constructors in unions, and we need
470 #define HB_NO_COPY_ASSIGN(TypeName) \
471 TypeName(const TypeName&); \
472 void operator=(const TypeName&)
473 #define HB_NO_COPY_ASSIGN_TEMPLATE(TypeName, T) \
474 TypeName(const TypeName<T>&); \
475 void operator=(const TypeName<T>&)
476 #define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) \
477 TypeName(const TypeName<T1, T2>&); \
478 void operator=(const TypeName<T1, T2>&)
479 #define HB_NO_CREATE_COPY_ASSIGN(TypeName) \
481 TypeName(const TypeName&); \
482 void operator=(const TypeName&)
483 #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T) \
485 TypeName(const TypeName<T>&); \
486 void operator=(const TypeName<T>&)
487 #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) \
489 TypeName(const TypeName<T1, T2>&); \
490 void operator=(const TypeName<T1, T2>&)
492 #else /* __cpluspplus >= 201103L */
494 #define HB_NO_COPY_ASSIGN(TypeName) static_assert (true, "")
495 #define HB_NO_COPY_ASSIGN_TEMPLATE(TypeName, T) static_assert (true, "")
496 #define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) static_assert (true, "")
497 #define HB_NO_CREATE_COPY_ASSIGN(TypeName) static_assert (true, "")
498 #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T) static_assert (true, "")
499 #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) static_assert (true, "")
501 #endif /* __cpluspplus >= 201103L */
505 * Compiler-assisted vectorization parameters.
509 * Disable vectorization for now. To correctly use them, we should
510 * use posix_memalign() to allocate in hb_vector_t. Otherwise, can
511 * cause misaligned access.
513 * https://bugs.chromium.org/p/chromium/issues/detail?id=860184
515 #if !defined(HB_VECTOR_SIZE)
516 # define HB_VECTOR_SIZE 0
519 /* The `vector_size' attribute was introduced in gcc 3.1. */
520 #if !defined(HB_VECTOR_SIZE)
521 # if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
522 # define HB_VECTOR_SIZE 128
524 # define HB_VECTOR_SIZE 0
527 static_assert (0 == (HB_VECTOR_SIZE & (HB_VECTOR_SIZE - 1)), "HB_VECTOR_SIZE is not power of 2.");
528 static_assert (0 == (HB_VECTOR_SIZE % 64), "HB_VECTOR_SIZE is not multiple of 64.");
530 typedef uint64_t hb_vector_size_impl_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
532 typedef uint64_t hb_vector_size_impl_t;
536 /* HB_NDEBUG disables some sanity checks that are very safe to disable and
537 * should be disabled in production systems. If NDEBUG is defined, enable
538 * HB_NDEBUG; but if it's desirable that normal assert()s (which are very
539 * light-weight) to be enabled, then HB_DEBUG can be defined to disable
540 * the costlier checks. */
548 /* Enable bitwise ops on enums marked as flags_t */
549 /* To my surprise, looks like the function resolver is happy to silently cast
550 * one enum to another... So this doesn't provide the type-checking that I
551 * originally had in mind... :(.
553 * For MSVC warnings, see: https://github.com/harfbuzz/harfbuzz/pull/163
556 # pragma warning(disable:4200)
557 # pragma warning(disable:4800)
559 #define HB_MARK_AS_FLAG_T(T) \
561 static inline T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
562 static inline T operator & (T l, T r) { return T ((unsigned) l & (unsigned) r); } \
563 static inline T operator ^ (T l, T r) { return T ((unsigned) l ^ (unsigned) r); } \
564 static inline T operator ~ (T r) { return T (~(unsigned int) r); } \
565 static inline T& operator |= (T &l, T r) { l = l | r; return l; } \
566 static inline T& operator &= (T& l, T r) { l = l & r; return l; } \
567 static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
569 static_assert (true, "")
571 /* Useful for set-operations on small enums.
572 * For example, for testing "x ∈ {x1, x2, x3}" use:
573 * (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
575 #define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (((uint32_t) 1U) << (unsigned)(x)))
576 #define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (((uint32_t) 1U) << (unsigned)(x)) : 0)
577 #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
578 #define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (((uint64_t) 1ULL) << (unsigned)(x)))
579 #define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (((uint64_t) 1ULL) << (unsigned)(x)) : 0)
582 /* Size signifying variable-sized array */
586 /* fallback for round() */
591 return floor (x + 0.5);
593 return ceil (x - 0.5);
595 #if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
596 #define round(x) _hb_round(x)
600 /* fallback for posix_memalign() */
602 _hb_memalign(void **memptr, size_t alignment, size_t size)
604 if (unlikely (0 != (alignment & (alignment - 1)) ||
606 0 != (alignment & (sizeof (void *) - 1))))
609 char *p = (char *) malloc (size + alignment - 1);
613 size_t off = (size_t) p & (alignment - 1);
615 p += alignment - off;
617 *memptr = (void *) p;
621 #if !defined(posix_memalign) && !defined(HAVE_POSIX_MEMALIGN)
622 #define posix_memalign _hb_memalign
627 * For lack of a better place, put Zawgyi script hack here.
628 * https://github.com/harfbuzz/harfbuzz/issues/1162
631 #define HB_SCRIPT_MYANMAR_ZAWGYI ((hb_script_t) HB_TAG ('Q','a','a','g'))
634 /* Some really basic things everyone wants. */
635 template <typename T> struct hb_remove_const { typedef T value; };
636 template <typename T> struct hb_remove_const<const T> { typedef T value; };
637 #define hb_remove_const(T) hb_remove_const<T>::value
638 template <typename T> struct hb_remove_reference { typedef T value; };
639 template <typename T> struct hb_remove_reference<T &> { typedef T value; };
640 #define hb_remove_reference(T) hb_remove_reference<T>::value
641 template <typename T> struct hb_remove_pointer { typedef T value; };
642 template <typename T> struct hb_remove_pointer<T *> { typedef T value; };
643 #define hb_remove_pointer(T) hb_remove_pointer<T>::value
646 /* Headers we include for everyone. Keep topologically sorted by dependency.
647 * They express dependency amongst themselves, but no other file should include
649 #include "hb-atomic.hh"
650 #include "hb-mutex.hh"
651 #include "hb-null.hh"
652 #include "hb-dsalgs.hh" // Requires: hb-null
653 #include "hb-iter.hh" // Requires: hb-null
654 #include "hb-debug.hh" // Requires: hb-atomic hb-dsalgs
655 #include "hb-array.hh" // Requires: hb-dsalgs hb-iter hb-null
656 #include "hb-vector.hh" // Requires: hb-array hb-null
657 #include "hb-object.hh" // Requires: hb-atomic hb-mutex hb-vector