Use autoconf FLEXIBLE_ARRAY_MEMBER when available

pull/1/head
Behdad Esfahbod 15 years ago
parent d33f674cb7
commit c65b26acf2
  1. 2
      configure.ac
  2. 4
      src/hb-ot-layout-gpos-private.hh
  3. 13
      src/hb-private.h

@ -11,6 +11,8 @@ AC_PROG_LIBTOOL dnl ([1.4]) Don't remove!
AC_PROG_CC
AC_PROG_CXX
AC_C_FLEXIBLE_ARRAY_MEMBER
AC_CHECK_FUNCS(mprotect sysconf getpagesize)
AC_CHECK_HEADERS(unistd.h sys/mman.h)

@ -35,8 +35,8 @@
typedef SHORT Value;
typedef Value ValueRecord[VAR];
ASSERT_SIZE_VAR (Value, 0, ValueRecord);
typedef Value ValueRecord[VAR0];
ASSERT_SIZE_VAR (ValueRecord, 0, Value);
struct ValueFormat : USHORT
{

@ -148,11 +148,18 @@ typedef int hb_mutex_t;
#define ASSERT_SIZE(_type, _size) ASSERT_STATIC (sizeof (_type) == (_size))
#define VAR 1 /* Size signifying variable-sized array */
/* Size signifying variable-sized array */
#ifdef FLEXIBLE_ARRAY_MEMBER
#define VAR FLEXIBLE_ARRAY_MEMBER
#else
#define VAR 1
#endif
#define VAR0 (VAR+0)
#define ASSERT_SIZE_VAR(_type, _size, _var_type) \
ASSERT_STATIC (sizeof (_type) == (_size) + VAR * sizeof (_var_type))
ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type))
#define ASSERT_SIZE_VAR2(_type, _size, _var_type1, _var_type2) \
ASSERT_STATIC (sizeof (_type) == (_size) + VAR * sizeof (_var_type1) + VAR * sizeof (_var_type2))
ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type1) + VAR0 * sizeof (_var_type2))
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define _HB_BOOLEAN_EXPR(expr) \

Loading…
Cancel
Save