summaryrefslogtreecommitdiff
path: root/thirdparty/harfbuzz/src/hb-null.hh
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-24 23:07:30 +0200
committerGitHub <noreply@github.com>2022-07-24 23:07:30 +0200
commit72c2f7ef160f37fdd0b0412d9b329e6c7b67a721 (patch)
tree5d1acde6740da9cd5ae636e4ba92fae54f63f329 /thirdparty/harfbuzz/src/hb-null.hh
parent0d1dacc902904d6eedc74f9a0a04069e6111591d (diff)
parent5f5a9f256cad866172c18939e31162ba038ac02e (diff)
Merge pull request #63404 from bruvzg/hb-501
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-null.hh')
-rw-r--r--thirdparty/harfbuzz/src/hb-null.hh31
1 files changed, 30 insertions, 1 deletions
diff --git a/thirdparty/harfbuzz/src/hb-null.hh b/thirdparty/harfbuzz/src/hb-null.hh
index 78eb6474d5..0d7f4da79e 100644
--- a/thirdparty/harfbuzz/src/hb-null.hh
+++ b/thirdparty/harfbuzz/src/hb-null.hh
@@ -39,6 +39,24 @@
#define HB_NULL_POOL_SIZE 448
+template <typename T, typename>
+struct _hb_has_min_size : hb_false_type {};
+template <typename T>
+struct _hb_has_min_size<T, hb_void_t<decltype (T::min_size)>>
+ : hb_true_type {};
+template <typename T>
+using hb_has_min_size = _hb_has_min_size<T, void>;
+#define hb_has_min_size(T) hb_has_min_size<T>::value
+
+template <typename T, typename>
+struct _hb_has_null_size : hb_false_type {};
+template <typename T>
+struct _hb_has_null_size<T, hb_void_t<decltype (T::null_size)>>
+ : hb_true_type {};
+template <typename T>
+using hb_has_null_size = _hb_has_null_size<T, void>;
+#define hb_has_null_size(T) hb_has_null_size<T>::value
+
/* Use SFINAE to sniff whether T has min_size; in which case return the larger
* of sizeof(T) and T::null_size, otherwise return sizeof(T).
*
@@ -117,8 +135,19 @@ struct NullHelper
}; \
namespace Namespace { \
static_assert (true, "") /* Require semicolon after. */
+#define DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1(Namespace, Type, Size) \
+ } /* Close namespace. */ \
+ extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Size]; \
+ template <typename Spec> \
+ struct Null<Namespace::Type<Spec>> { \
+ static Namespace::Type<Spec> const & get_null () { \
+ return *reinterpret_cast<const Namespace::Type<Spec> *> (_hb_Null_##Namespace##_##Type); \
+ } \
+ }; \
+ namespace Namespace { \
+ static_assert (true, "") /* Require semicolon after. */
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
- const unsigned char _hb_Null_##Namespace##_##Type[hb_null_size (Namespace::Type)]
+ const unsigned char _hb_Null_##Namespace##_##Type[sizeof (_hb_Null_##Namespace##_##Type)]
/* Specializations for arbitrary-content Null objects expressed as struct initializer. */
#define DECLARE_NULL_INSTANCE(Type) \