GNOME Bugzilla – Bug 610183
Pango doesn't compile with gcc 3.3.3
Last modified: 2010-03-09 18:02:37 UTC
When compiling pango 1.26.2 under SLES9, which uses gcc 3.3.3, I get the following error: make all-recursive make[1]: Entering directory `/lhome1/s2ksde/Downloads/pango-1.26.2' Making all in pango make[2]: Entering directory `/lhome1/s2ksde/Downloads/pango-1.26.2/pango' GEN s-enum-types-h GEN s-enum-types-c make all-recursive make[3]: Entering directory `/lhome1/s2ksde/Downloads/pango-1.26.2/pango' Making all in opentype make[4]: Entering directory `/lhome1/s2ksde/Downloads/pango-1.26.2/pango/opentype' CC libharfbuzz_la-hb-blob.lo CC libharfbuzz_la-hb-buffer.lo CXX libharfbuzz_la-hb-font.lo In file included from hb-open-file-private.hh:30, from hb-font.cc:31: hb-open-type-private.hh:224: error: syntax error before `__attribute__' hb-open-type-private.hh: In function `bool _hb_sanitize_edit(...)': hb-open-type-private.hh:228: error: syntax error before `->' token hb-open-type-private.hh:408: error: explicit specialization in non-namespace scope `bool _hb_sanitize_edit(...)' hb-open-type-private.hh:408: error: template-argument ` _hb_sanitize_edit(...)::Tag' uses local type `_hb_sanitize_edit(...)::Tag' hb-open-type-private.hh:408: error: can't make `get' into a method -- not in a class hb-open-type-private.hh:495: error: type specifier omitted for parameter ` GenericOffsetTo<OffsetType, Type>' hb-open-type-private.hh:495: error: syntax error before `)' token hb-open-type-private.hh:495: error: `const Type& operator+(...)' must have an argument of class or enumerated type hb-open-type-private.hh:495: error: `const Type& operator+(...)' must take either one or two arguments hb-open-type-private.hh: In function `const Type& operator+(...)': hb-open-type-private.hh:498: error: template argument is required for ` operator+(...)::OffsetTo<Type>' hb-open-type-private.hh:498: error: syntax error before `<' token hb-open-type-private.hh:501: error: template argument is required for ` operator+(...)::LongOffsetTo<Type>' hb-open-type-private.hh:501: error: syntax error before `<' token hb-open-type-private.hh:510: error: template argument is required for ` operator+(...)::GenericArrayOf<LenType, Type>' hb-open-type-private.hh:511: error: can't make `const_array' into a method -- not in a class hb-open-type-private.hh:512: error: can't make `array' into a method -- not in a class hb-open-type-private.hh:515: error: can't make `operator[]' into a method -- not in a class hb-open-type-private.hh:520: error: can't make `get_size' into a method -- not in a class hb-open-type-private.hh:522: error: can't make `sanitize' into a method -- not in a class hb-open-type-private.hh:536: error: can't make `sanitize' into a method -- not in a class hb-open-type-private.hh:545: error: can't make `sanitize' into a method -- not in a class hb-open-type-private.hh:554: error: can't make `sanitize' into a method -- not in a class hb-open-type-private.hh:564: confused by earlier errors, bailing out After examining the sources and looking into pango/opentype/hb-private.h I realized that changing #if __GNUC__ >= 3 #define HB_GNUC_UNUSED __attribute__((unused)) #define HB_GNUC_PURE __attribute__((pure)) #define HB_GNUC_CONST __attribute__((const)) #else #define HB_GNUC_UNUSED #define HB_GNUC_PURE #define HB_GNUC_CONST #endif so that __attribute__ isn't used makes pango compile correctly. It's a bit strange as it seems from gcc documentation that the used __attribute__ values should be supported by gcc 3.3.3, but well, this is what happens...
But isn't __GNUC__ >= 3 true for 3.3.3?!
Oh, I see what you mean. I'll change it to >= 4 then.
Humm, I checked around and glib is compiling fine with gcc 3.3.3 and has those same macros. Can you dig into this further and see what this is happening? Maybe the attribute is placed in a location that is not supported by gcc 3?
OK, it seems that gcc doesn't like it only when the __attribute__((unused)) is used for a formal parameter of a function. When I removed HB_GNUC_UNUSED from the parameter definition of static HB_GNUC_UNUSED inline bool _hb_sanitize_edit (SANITIZE_ARG_DEF, const char *base HB_GNUC_UNUSED, unsigned int len HB_GNUC_UNUSED) in pango/opentype/hb-open-type-private.hh and #define APPLY_ARG_DEF \ hb_ot_layout_context_t *context, \ hb_buffer_t *buffer, \ unsigned int context_length HB_GNUC_UNUSED, \ unsigned int nesting_level_left HB_GNUC_UNUSED, \ unsigned int lookup_flag, \ unsigned int property HB_GNUC_UNUSED /* propety of first glyph */ \ TRACE_APPLY_ARG_DEF in pango/opentype/hb-ot-layout-gsubgpos-private.hh everything compiled fine. If you don't want to sacrifice these compiler hints for newer gcc's that support it, I guess that the best workaround for this case is not to use __attribute__((unused)) for gcc < 3.4 (not sure if 3.4 fixes this or not). The use of the older gcc is quite rare I guess and it's not such a big deal if you don't have these optimization hints.
Ok, fixed. Thanks.
*** Bug 612322 has been marked as a duplicate of this bug. ***