bug 603879 - part 1.1 - work around gcc4.3/opt compile failure in harfbuzz code. a=bustage
authorJonathan Kew <jfkthame@gmail.com>
Sat, 20 Nov 2010 17:49:12 +0000
changeset 57947 566c74963913f3b8792e6a334505d476b14055a7
parent 57946 af5a5452cda4fd6e83e9d797f484feb0e2429393
child 57948 11ca3cd81864621a74efb90cf15398067f27e891
push idunknown
push userunknown
push dateunknown
reviewersbustage
bugs603879
milestone2.0b8pre
bug 603879 - part 1.1 - work around gcc4.3/opt compile failure in harfbuzz code. a=bustage
gfx/harfbuzz/src/hb-open-type-private.hh
--- a/gfx/harfbuzz/src/hb-open-type-private.hh
+++ b/gfx/harfbuzz/src/hb-open-type-private.hh
@@ -700,28 +700,36 @@ struct HeadlessArrayOf
   }
 
   USHORT len;
   Type array[VAR];
   public:
   DEFINE_SIZE_ARRAY (sizeof (USHORT), array);
 };
 
+#if __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
+// work around GCC 4.3 bug where the search() function gets improperly
+// optimized away from some instantiations of this template
+#pragma GCC visibility push(default)
+#endif
 
 /* An array with sorted elements.  Supports binary searching. */
 template <typename Type>
 struct SortedArrayOf : ArrayOf<Type> {
 
   template <typename SearchType>
   inline int search (const SearchType &x) const {
     class Cmp {
       public: static int cmp (const SearchType *a, const Type *b) { return b->cmp (*a); }
     };
     const Type *p = (const Type *) bsearch (&x, this->array, this->len, sizeof (this->array[0]), (hb_compare_func_t) Cmp::cmp);
     return p ? p - this->array : -1;
   }
 };
 
+#if __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
+#pragma GCC visibility pop
+#endif
 
 HB_BEGIN_DECLS
 HB_END_DECLS
 
 #endif /* HB_OPEN_TYPE_PRIVATE_HH */