[null] Silence undefined-behavior complaints with too-small null bytes

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1577584
This commit is contained in:
Behdad Esfahbod 2019-09-06 11:53:11 -04:00
parent 3c81246f66
commit 911c76abcd
1 changed files with 6 additions and 0 deletions

View File

@ -48,8 +48,14 @@
template <typename T, typename>
struct _hb_null_size : hb_integral_constant<unsigned, sizeof (T)> {};
#ifdef HB_TINY
/* Disabled unless tiny, to avoid undefined-behavior.
* Enabling it saves a couple hundred bytes only.
* To make https://bugzilla.mozilla.org/show_bug.cgi?id=810823 happy.
*/
template <typename T>
struct _hb_null_size<T, hb_void_t<decltype (T::min_size)>> : hb_integral_constant<unsigned, T::null_size> {};
#endif
template <typename T>
using hb_null_size = _hb_null_size<T, void>;