[HarfBuzz] Funky harfbuzz compile error

Behdad Esfahbod behdad at behdad.org
Thu Apr 28 14:31:41 PDT 2011


On 04/27/11 14:04, Evan Martin wrote:
> On Tue, Apr 26, 2011 at 10:41 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
>> On 04/26/11 17:46, Wouter Bolsterlee wrote:
>>>         -  inline void set (int v) { return hb_atomic_int_set (ref_count, v); }
>>>         +  inline void set (int v) { hb_atomic_int_set (ref_count, v); }
>>
>> Ah, I'm really sorry about that.  Fixed.  I'm yet to find a gcc option to warn
>> about this error I keep making via copy/pasted code.
> 
> It's really easy to set up clang (two svn checkout commands,
> ./configure --enable-optimized; make; export CC=/path/to/clang/clang)
> and it catches many more of these sorts of problems.  I frequently use
> it when developing these days.

Humm.  Seems like clang doesn't like our ASSERT_STATIC macros:


  CXX    libharfbuzz_la-hb-font.lo
In file included from hb-font.cc:31:
./hb-open-file-private.hh:252:3: fatal error: variable length arrays are not
permitted in C++
  DEFINE_SIZE_UNION (4, tag);
  ^
In file included from hb-font.cc:31:
In file included from ./hb-open-file-private.hh:30:
./hb-open-type-private.hh:101:3: note: instantiated from:
  _DEFINE_SIZE_ASSERTION (this->u._member.static_size == (size)); \
  ^
./hb-open-type-private.hh:85:5: note: instantiated from:
  { ASSERT_STATIC (_assertion); }
    ^
In file included from hb-font.cc:27:
./hb-private.hh:85:30: note: instantiated from:
#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
                             ^
./hb-private.hh:84:39: note: instantiated from:
#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
                                      ^
./hb-private.hh:83:90: note: instantiated from:
#define _ASSERT_STATIC1(_line, _cond) typedef int
_static_assert_on_line_##_line##_failed[(_cond)?1:-1]


I haven't checked the standard to see if static const members of defined
classes are considered const expressions or not.  But even changing that,
clang gives up with a weird message:

1.	<eof> parser at end of file
2.	./hb-open-type-private.hh:283:21: instantiating function definition
'Sanitizer<struct head>::sanitize'
clang: error: compiler command failed due to signal 11 (use -v to see invocation)


My clang is probably really old:

  clang version 1.1 (branches/release_27)

I'll try a newer version later.

Thanks!
behdad



More information about the HarfBuzz mailing list