src/hb-private.hh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 672ca3b4e65a75fb3a418ec5d117ad242a98acbb
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Mon Oct 26 14:05:05 2015 -0700

    Use templates for making sure expression is constant

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 5ff1444..53e0510 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -240,9 +240,9 @@ static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) 
{ return n; }
 #define _ASSERT_STATIC0(_line, _cond)  _ASSERT_STATIC1 (_line, (_cond))
 #define ASSERT_STATIC(_cond)           _ASSERT_STATIC0 (__LINE__, (_cond))
 
-/* Note: C++ allows sizeof() of variable-lengh arrays.  So, if _cond is not
- * constant, it still compiles (ouch!), but at least we'll get a -Wvla 
warning. */
-#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof 
(char[(_cond) ? 1 : -1]))
+template <unsigned int cond> class hb_assert_constant_t {};
+
+#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof 
(hb_assert_constant_t<_cond>))
 
 #define _PASTE1(a,b) a##b
 #define PASTE(a,b) _PASTE1(a,b)
_______________________________________________
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to