[HarfBuzz] harfbuzz: Branch 'master' - 7 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Sep 30 16:35:36 UTC 2018


 .circleci/config.yml        |    2 +-
 src/hb-blob.cc              |    5 -----
 src/hb-buffer.h             |    5 +++--
 src/hb-common.h             |    8 +++++---
 src/hb.hh                   |    4 ++++
 test/api/hb-test.h          |    1 +
 test/api/test-blob.c        |    2 +-
 test/api/test-c.c           |    2 +-
 test/api/test-font.c        |   16 ++++++++--------
 test/api/test-multithread.c |   16 ++++++++--------
 test/api/test-ot-color.c    |    2 +-
 test/api/test-shape.c       |   14 +++++++-------
 test/api/test-unicode.c     |   10 +++++-----
 13 files changed, 45 insertions(+), 42 deletions(-)

New commits:
commit dc9b47ae87096d34d146e50e44e742a76861976f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:35:12 2018 +0200

    [msan] Remove uninstrumented libraries

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8bf23250..4db6dceb 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -126,7 +126,7 @@ jobs:
       - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10
       - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd ..
       - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd ..
-      - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2
+      - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib
       - run: make -j32
       - run: MSAN_OPTIONS=exitcode=42 make check --ignore-errors
       # always run fail, till we fix msan "make check" isssue and remove --ignore-erros, then we can merge the two lines
commit ad1c190ecfbac66ffeef69db769073a33331eed3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:26:45 2018 +0200

    Correct fix for glib-mkenum warning

diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 4ed458fb..4c746f40 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -93,8 +93,7 @@ typedef struct hb_glyph_info_t
 typedef enum { /*< flags >*/
   HB_GLYPH_FLAG_UNSAFE_TO_BREAK		= 0x00000001,
 
-  /*< private >*/
-  HB_GLYPH_FLAG_DEFINED			= 0x00000001 /* OR of all defined flags */
+  HB_GLYPH_FLAG_DEFINED			= 0x00000001 /*< skip >*/ /* OR of all defined flags */
 } hb_glyph_flags_t;
 
 HB_EXTERN hb_glyph_flags_t
commit 1dd1e56bf42af5b11afc3e34f78869e93d39867e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:25:58 2018 +0200

    Revert "Fix glib-mkenum warning"
    
    This reverts commit 247756a7d89008ee6a7d1171dc07ba22454c6034.
    
    Was wrong.  Right fix coming.

diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index 7d60b4f1..4ed458fb 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -62,7 +62,9 @@ HB_BEGIN_DECLS
 typedef struct hb_glyph_info_t
 {
   hb_codepoint_t codepoint;
+  /*< private >*/
   hb_mask_t      mask;
+  /*< public >*/
   uint32_t       cluster;
 
   /*< private >*/
commit 3f08750fa6772e7e342b96192b84cb9963f7335b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:23:34 2018 +0200

    Move _POSIX_SOURCE to hb.hh

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index f0952665..c1ed0f2a 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -25,11 +25,6 @@
  * Red Hat Author(s): Behdad Esfahbod
  */
 
-/* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200809L
-#endif
-
 #include "hb.hh"
 #include "hb-blob.hh"
 
diff --git a/src/hb.hh b/src/hb.hh
index 631592de..cfe6d68f 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -35,6 +35,10 @@
 #include "config.h"
 #endif
 
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200809L
+#endif
+
 #include "hb.h"
 #define HB_H_IN
 #ifdef HAVE_OT
commit 90dd255e570bf8ea3436e2f29242068845256e55
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:19:54 2018 +0200

    Change _HB_SCRIPT_MAX_VALUE from 0xFFFFFFFF to 0x7FFFFFFF
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/504

diff --git a/src/hb-common.h b/src/hb-common.h
index 37bbb2b1..6101d72f 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -340,13 +340,15 @@ typedef enum
   HB_SCRIPT_INVALID				= HB_TAG_NONE,
 
   /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
-   * without risking undefined behavior.  Include both a signed and unsigned max,
-   * since technically enums are int, and indeed, hb_script_t ends up being signed.
+   * without risking undefined behavior.  We have two, for historical reasons.
+   * HB_TAG_MAX used to be unsigned, but that was invalid Ansi C, so was changed
+   * to _HB_SCRIPT_MAX_VALUE to be equal to HB_TAG_MAX_SIGNED as well.
+   *
    * See this thread for technicalities:
    *
    *   https://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
    */
-  _HB_SCRIPT_MAX_VALUE				= HB_TAG_MAX, /*< skip >*/
+  _HB_SCRIPT_MAX_VALUE				= HB_TAG_MAX_SIGNED, /*< skip >*/
   _HB_SCRIPT_MAX_VALUE_SIGNED			= HB_TAG_MAX_SIGNED /*< skip >*/
 
 } hb_script_t;
commit dcfcb950b81a2865ef01f5a69087264b79ed1bfd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:14:50 2018 +0200

    [test] Fix -Wunused-parameter warnings

diff --git a/test/api/hb-test.h b/test/api/hb-test.h
index 307845f6..39d091b6 100644
--- a/test/api/hb-test.h
+++ b/test/api/hb-test.h
@@ -42,6 +42,7 @@ HB_BEGIN_DECLS
 /* Just in case */
 #undef G_DISABLE_ASSERT
 
+#define HB_UNUSED	G_GNUC_UNUSED
 
 /* Misc */
 
diff --git a/test/api/test-blob.c b/test/api/test-blob.c
index d566f4e9..7914a26c 100644
--- a/test/api/test-blob.c
+++ b/test/api/test-blob.c
@@ -195,7 +195,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data)
 }
 
 static void
-fixture_finish (fixture_t *fixture, gconstpointer user_data)
+fixture_finish (fixture_t *fixture, gconstpointer user_data HB_UNUSED)
 {
   hb_blob_destroy (fixture->blob);
   g_assert_cmpint (fixture->freed, ==, 1);
diff --git a/test/api/test-c.c b/test/api/test-c.c
index 4b43b837..78d6e974 100644
--- a/test/api/test-c.c
+++ b/test/api/test-c.c
@@ -58,7 +58,7 @@
 #endif
 
 int
-main (int argc, char **argv)
+main (void)
 {
   return !*hb_shape_list_shapers ();
 }
diff --git a/test/api/test-font.c b/test/api/test-font.c
index 4a2393ec..4cd8dd8b 100644
--- a/test/api/test-font.c
+++ b/test/api/test-font.c
@@ -83,7 +83,7 @@ free_up (void *user_data)
 }
 
 static hb_blob_t *
-get_table (hb_face_t *face, hb_tag_t tag, void *user_data)
+get_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data HB_UNUSED)
 {
   if (tag == HB_TAG ('a','b','c','d'))
     return hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL);
@@ -210,10 +210,10 @@ test_fontfuncs_nil (void)
 }
 
 static hb_bool_t
-contour_point_func1 (hb_font_t *font, void *font_data,
-		     hb_codepoint_t glyph, unsigned int point_index,
+contour_point_func1 (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
+		     hb_codepoint_t glyph, unsigned int point_index HB_UNUSED,
 		     hb_position_t *x, hb_position_t *y,
-		     void *user_data)
+		     void *user_data HB_UNUSED)
 {
   if (glyph == 1) {
     *x = 2;
@@ -230,10 +230,10 @@ contour_point_func1 (hb_font_t *font, void *font_data,
 }
 
 static hb_bool_t
-contour_point_func2 (hb_font_t *font, void *font_data,
+contour_point_func2 (hb_font_t *font, void *font_data HB_UNUSED,
 		     hb_codepoint_t glyph, unsigned int point_index,
 		     hb_position_t *x, hb_position_t *y,
-		     void *user_data)
+		     void *user_data HB_UNUSED)
 {
   if (glyph == 1) {
     *x = 6;
@@ -246,9 +246,9 @@ contour_point_func2 (hb_font_t *font, void *font_data,
 }
 
 static hb_position_t
-glyph_h_advance_func1 (hb_font_t *font, void *font_data,
+glyph_h_advance_func1 (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
 		       hb_codepoint_t glyph,
-		       void *user_data)
+		       void *user_data HB_UNUSED)
 {
   if (glyph == 1)
     return 8;
diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c
index b9efca9b..de288b6a 100644
--- a/test/api/test-multithread.c
+++ b/test/api/test-multithread.c
@@ -101,7 +101,7 @@ thread_func (void *data)
   return 0;
 }
 
-void
+static void
 test_body (void)
 {
   int i;
diff --git a/test/api/test-ot-color.c b/test/api/test-ot-color.c
index 22584d20..254f0155 100644
--- a/test/api/test-ot-color.c
+++ b/test/api/test-ot-color.c
@@ -99,6 +99,7 @@ static hb_face_t *cpal_v0 = NULL;
 static hb_face_t *cpal_v1 = NULL;
 
 
+#if 0
 #define assert_color_rgba(colors, i, r, g, b, a) G_STMT_START {	\
   const hb_ot_color_t *_colors = (colors); \
   const size_t _i = (i); \
@@ -122,7 +123,6 @@ static hb_face_t *cpal_v1 = NULL;
 } G_STMT_END
 
 
-#if 0
 static void
 test_hb_ot_color_get_palette_count (void)
 {
diff --git a/test/api/test-shape.c b/test/api/test-shape.c
index 6232e738..2a0024d0 100644
--- a/test/api/test-shape.c
+++ b/test/api/test-shape.c
@@ -41,9 +41,9 @@
 static const char test_data[] = "test\0data";
 
 static hb_position_t
-glyph_h_advance_func (hb_font_t *font, void *font_data,
+glyph_h_advance_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
 		      hb_codepoint_t glyph,
-		      void *user_data)
+		      void *user_data HB_UNUSED)
 {
   switch (glyph) {
   case 1: return 10;
@@ -54,10 +54,10 @@ glyph_h_advance_func (hb_font_t *font, void *font_data,
 }
 
 static hb_bool_t
-glyph_func (hb_font_t *font, void *font_data,
-	    hb_codepoint_t unicode, hb_codepoint_t variant_selector,
+glyph_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
+	    hb_codepoint_t unicode, hb_codepoint_t variation_selector HB_UNUSED,
 	    hb_codepoint_t *glyph,
-	    void *user_data)
+	    void *user_data HB_UNUSED)
 {
   switch (unicode) {
   case 'T': *glyph = 1; return TRUE;
@@ -68,9 +68,9 @@ glyph_func (hb_font_t *font, void *font_data,
 }
 
 static hb_position_t
-glyph_h_kerning_func (hb_font_t *font, void *font_data,
+glyph_h_kerning_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
 		      hb_codepoint_t left, hb_codepoint_t right,
-		      void *user_data)
+		      void *user_data HB_UNUSED)
 {
   if (left == 1 && right == 2)
     return -2;
diff --git a/test/api/test-unicode.c b/test/api/test-unicode.c
index 88f12e77..4238ca99 100644
--- a/test/api/test-unicode.c
+++ b/test/api/test-unicode.c
@@ -645,18 +645,18 @@ typedef struct {
 } data_fixture_t;
 
 static void
-data_fixture_init (data_fixture_t *f, gconstpointer user_data)
+data_fixture_init (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
 {
   f->data[0].value = MAGIC0;
   f->data[1].value = MAGIC1;
 }
 static void
-data_fixture_finish (data_fixture_t *f, gconstpointer user_data)
+data_fixture_finish (data_fixture_t *f HB_UNUSED, gconstpointer user_data HB_UNUSED)
 {
 }
 
 static void
-test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data)
+test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
 {
   hb_unicode_funcs_t *uf, *aa;
 
@@ -678,7 +678,7 @@ test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data)
 }
 
 static void
-test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data)
+test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
 {
   hb_unicode_funcs_t *uf, *aa;
 
@@ -697,7 +697,7 @@ test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data)
 }
 
 static void
-test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data)
+test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNUSED)
 {
   hb_unicode_funcs_t *uf, *aa;
 
commit be0b2ed3162f465dbf44a0f018d4e2af5dcdf87c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Sep 30 18:01:20 2018 +0200

    More warning fixes

diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c
index 7e357fd5..b9efca9b 100644
--- a/test/api/test-multithread.c
+++ b/test/api/test-multithread.c
@@ -33,8 +33,8 @@
 #include <hb-ft.h>
 #include <hb-ot.h>
 
-const char *text = "طرح‌نَما";
-const char *path =
+static const char *text = "طرح‌نَما";
+static const char *path =
 #if defined(__linux__)
 		"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf";
 #elif defined(_WIN32) || defined(_WIN64)
@@ -43,11 +43,11 @@ const char *path =
 		"/Library/Fonts/Tahoma.ttf";
 #endif
 
-int num_threads = 30;
-int num_iters = 200;
+static int num_threads = 30;
+static int num_iters = 200;
 
-hb_font_t *font;
-hb_buffer_t *ref_buffer;
+static hb_font_t *font;
+static hb_buffer_t *ref_buffer;
 
 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -102,7 +102,7 @@ thread_func (void *data)
 }
 
 void
-test_body ()
+test_body (void)
 {
   int i;
   int num_threads = 30;


More information about the HarfBuzz mailing list