[HarfBuzz] compilation problem in hb-set-private.hh

Jonathan Kew jfkthame at googlemail.com
Sat May 5 05:49:45 PDT 2012

With current hbng master, I'm hitting a compilation failure with GCC 
4.2.1, as it doesn't like the last STATIC_ASSERT here:

   CXX    libharfbuzz_la-hb-set.lo
In file included from ../../src/hb-set.cc:27:
../../src/hb-set-private.hh:131: error: invalid use of non-static data 
member '_hb_set_t::elts'
../../src/hb-set-private.hh:134: error: from this location

Using clang instead still fails at the same place:

In file included from ../../src/hb-set.cc:27:
../../src/hb-set-private.hh:134:26: error: invalid use of nonstatic data 
member 'elts'
   ASSERT_STATIC (sizeof (elts) * 8 > MAX_G);
../../src/hb-private.hh:89:58: note: expanded from macro 'ASSERT_STATIC'
#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
../../src/hb-private.hh:88:64: note: expanded from macro '_ASSERT_STATIC0'
#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
../../src/hb-private.hh:87:92: note: expanded from macro '_ASSERT_STATIC1'
#define _ASSERT_STATIC1(_line, _cond) typedef int 

I suppose you could change the STATIC_ASSERT to something like

   ASSERT_STATIC (sizeof (elt_t) * ELTS * 8 > MAX_G);

and that would avoid the failure.

BTW, clang also reports a warning in main.cc:

../../src/main.cc:129:52: warning: data argument not used by format 
string [-Wformat-extra-args]
                    : "      Language System %2d of %2d: %.4s\n", 
n_langsys, num_langsys,

This is harmless - it refers to the case where n_langsys == -1, so that 
the format string without placeholders is used - but maybe it'd be worth 
rewriting this using if-else to get a warning-free compilation.


More information about the HarfBuzz mailing list