Fix llvm-gcc-4.2 compile issue and add a macOS bot to test it (#899)
authorEbrahim Byagowi <ebrahim@gnu.org>
Fri, 23 Mar 2018 14:07:01 +0000 (18:37 +0430)
committerGitHub <noreply@github.com>
Fri, 23 Mar 2018 14:07:01 +0000 (18:37 +0430)
.circleci/config.yml
src/hb-open-file-private.hh
src/hb-ot-glyf-table.hh
src/hb-ot-kern-table.hh

index 8ef1058..19beeee 100644 (file)
@@ -2,6 +2,19 @@ version: 2
 
 jobs:
 
+  macos-llvm-gcc-4.2:
+    macos:
+      xcode: "8.3.3"
+    steps:
+      - checkout
+      - run: brew update-reset
+      - run: brew install wget pkg-config libtool ragel freetype glib cairo
+      - run: wget https://packages.macports.org/llvm-gcc42/llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2 && tar zxvf llvm-gcc42-2336.11_3+universal.darwin_15.i386-x86_64.tbz2
+      - run: CC=$PWD/opt/local/bin/llvm-gcc-4.2 CXX=$PWD/opt/local/bin/llvm-g++-4.2 ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo
+      # Ignoring assembler complains, https://stackoverflow.com/a/39867021
+      - run: make 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
+      - run: make check || .ci/fail.sh
+
   distcheck:
     docker:
       - image: ubuntu:17.10
@@ -163,6 +176,9 @@ workflows:
   version: 2
   build:
     jobs:
+      # macOS
+      - macos-llvm-gcc-4.2
+
       # both autotools and cmake
       - distcheck
 
index e2644ea..ac02752 100644 (file)
@@ -295,11 +295,13 @@ struct OpenTypeFontFile
 {
   static const hb_tag_t tableTag       = HB_TAG ('_','_','_','_'); /* Sanitizer needs this. */
 
-  static const hb_tag_t CFFTag         = HB_TAG ('O','T','T','O'); /* OpenType with Postscript outlines */
-  static const hb_tag_t TrueTypeTag    = HB_TAG ( 0 , 1 , 0 , 0 ); /* OpenType with TrueType outlines */
-  static const hb_tag_t TTCTag         = HB_TAG ('t','t','c','f'); /* TrueType Collection */
-  static const hb_tag_t TrueTag                = HB_TAG ('t','r','u','e'); /* Obsolete Apple TrueType */
-  static const hb_tag_t Typ1Tag                = HB_TAG ('t','y','p','1'); /* Obsolete Apple Type1 font in SFNT container */
+  enum {
+    CFFTag             = HB_TAG ('O','T','T','O'), /* OpenType with Postscript outlines */
+    TrueTypeTag        = HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with TrueType outlines */
+    TTCTag             = HB_TAG ('t','t','c','f'), /* TrueType Collection */
+    TrueTag            = HB_TAG ('t','r','u','e'), /* Obsolete Apple TrueType */
+    Typ1Tag            = HB_TAG ('t','y','p','1')  /* Obsolete Apple Type1 font in SFNT container */
+  };
 
   inline hb_tag_t get_tag (void) const { return u.tag; }
 
index 7946706..4eb2ad1 100644 (file)
@@ -134,18 +134,20 @@ struct glyf
 
   struct CompositeGlyphHeader
   {
-    static const uint16_t ARG_1_AND_2_ARE_WORDS =      0x0001;
-    static const uint16_t ARGS_ARE_XY_VALUES =         0x0002;
-    static const uint16_t ROUND_XY_TO_GRID =           0x0004;
-    static const uint16_t WE_HAVE_A_SCALE =            0x0008;
-    static const uint16_t MORE_COMPONENTS =            0x0020;
-    static const uint16_t WE_HAVE_AN_X_AND_Y_SCALE =   0x0040;
-    static const uint16_t WE_HAVE_A_TWO_BY_TWO =       0x0080;
-    static const uint16_t WE_HAVE_INSTRUCTIONS =       0x0100;
-    static const uint16_t USE_MY_METRICS =             0x0200;
-    static const uint16_t OVERLAP_COMPOUND =           0x0400;
-    static const uint16_t SCALED_COMPONENT_OFFSET =    0x0800;
-    static const uint16_t UNSCALED_COMPONENT_OFFSET =  0x1000;
+    enum composite_glyph_flag_t {
+      ARG_1_AND_2_ARE_WORDS =      0x0001,
+      ARGS_ARE_XY_VALUES =         0x0002,
+      ROUND_XY_TO_GRID =           0x0004,
+      WE_HAVE_A_SCALE =            0x0008,
+      MORE_COMPONENTS =            0x0020,
+      WE_HAVE_AN_X_AND_Y_SCALE =   0x0040,
+      WE_HAVE_A_TWO_BY_TWO =       0x0080,
+      WE_HAVE_INSTRUCTIONS =       0x0100,
+      USE_MY_METRICS =             0x0200,
+      OVERLAP_COMPOUND =           0x0400,
+      SCALED_COMPONENT_OFFSET =    0x0800,
+      UNSCALED_COMPONENT_OFFSET =  0x1000
+    };
 
     HBUINT16 flags;
     HBUINT16 glyphIndex;
@@ -280,16 +282,18 @@ struct glyf
                                                 composite);
     }
 
+    enum simple_glyph_flag_t {
+      FLAG_X_SHORT = 0x02,
+      FLAG_Y_SHORT = 0x04,
+      FLAG_REPEAT = 0x08,
+      FLAG_X_SAME = 0x10,
+      FLAG_Y_SAME = 0x20
+    };
+
     /* based on FontTools _g_l_y_f.py::trim */
     inline bool remove_padding(unsigned int start_offset,
                                unsigned int *end_offset) const
     {
-      static const int FLAG_X_SHORT = 0x02;
-      static const int FLAG_Y_SHORT = 0x04;
-      static const int FLAG_REPEAT = 0x08;
-      static const int FLAG_X_SAME = 0x10;
-      static const int FLAG_Y_SAME = 0x20;
-
       if (*end_offset - start_offset < GlyphHeader::static_size)
         return true;
 
index 368f547..4d379ea 100644 (file)
@@ -205,7 +205,7 @@ struct KernSubTableWrapper
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (thiz()) &&
-                 thiz()->length >= thiz()->min_size &&
+                 thiz()->length >= T::min_size &&
                  c->check_array (thiz(), 1, thiz()->length) &&
                  thiz()->subtable.sanitize (c, thiz()->format));
   }