[vlc-commits] [Git][videolan/vlc][3.0.x] contrib: harfbuzz: Apply patches to fix building with Clang 16

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 2 08:28:18 UTC 2022



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
6e1a0b76 by Martin Storsjö at 2022-11-01T10:09:21+02:00
contrib: harfbuzz: Apply patches to fix building with Clang 16

This is a backport of
https://github.com/harfbuzz/harfbuzz/commit/d88269c827895b38f99f7cf741fa60210d4d5169
and
https://github.com/harfbuzz/harfbuzz/commit/60c6b7786d9f4651ae2803bfc4ff4435b38a5bc6.

(The first patch is enough to fix mingw builds, but the second one
is necessary if building harfbuzz on Linux with Clang 16.)

(cherry picked from commit 75b0e59be9f989eefd76769fe7b4ae54acfd1471)
Signed-off-by: Martin Storsjö <martin at martin.st>

- - - - -


3 changed files:

- + contrib/src/harfbuzz/0001-freetype-Fix-function-signatures-to-match-without-ca.patch
- + contrib/src/harfbuzz/0002-Disable-Wcast-function-type-strict.patch
- contrib/src/harfbuzz/rules.mak


Changes:

=====================================
contrib/src/harfbuzz/0001-freetype-Fix-function-signatures-to-match-without-ca.patch
=====================================
@@ -0,0 +1,67 @@
+From 1a4fd470808067717e6b9b228ec1cb0eab26039e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Fri, 28 Oct 2022 22:17:15 +0300
+Subject: [PATCH 1/2] freetype: Fix function signatures to match without casts
+
+Clang 16 has got a new stricter warning for casts of function types
+(see https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57).
+
+This new warning gets included as part of the existing error
+diagnostic setting of -Wcast-function-type.
+
+This fixes errors like these:
+
+../src/hb-ft.cc:1011:34: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
+    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
+                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---
+ src/hb-ft.cc | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/hb-ft.cc b/src/hb-ft.cc
+index 67691e3ff..37f9f7f84 100644
+--- a/src/hb-ft.cc
++++ b/src/hb-ft.cc
+@@ -732,8 +732,9 @@ hb_ft_face_create_referenced (FT_Face ft_face)
+ }
+ 
+ static void
+-hb_ft_face_finalize (FT_Face ft_face)
++hb_ft_face_finalize (void *arg)
+ {
++  FT_Face ft_face = (FT_Face) arg;
+   hb_face_destroy ((hb_face_t *) ft_face->generic.data);
+ }
+ 
+@@ -765,7 +766,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
+       ft_face->generic.finalizer (ft_face);
+ 
+     ft_face->generic.data = hb_ft_face_create (ft_face, nullptr);
+-    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
++    ft_face->generic.finalizer = hb_ft_face_finalize;
+   }
+ 
+   return hb_face_reference ((hb_face_t *) ft_face->generic.data);
+@@ -946,8 +947,9 @@ get_ft_library ()
+ }
+ 
+ static void
+-_release_blob (FT_Face ft_face)
++_release_blob (void *arg)
+ {
++  FT_Face ft_face = (FT_Face) arg;
+   hb_blob_destroy ((hb_blob_t *) ft_face->generic.data);
+ }
+ 
+@@ -1029,7 +1031,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
+ #endif
+ 
+   ft_face->generic.data = blob;
+-  ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
++  ft_face->generic.finalizer = _release_blob;
+ 
+   _hb_ft_font_set_funcs (font, ft_face, true);
+   hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
+-- 
+2.25.1
+


=====================================
contrib/src/harfbuzz/0002-Disable-Wcast-function-type-strict.patch
=====================================
@@ -0,0 +1,25 @@
+From b1f1c6e3951f7e28ce1c57248f8141cde40d2002 Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad at behdad.org>
+Date: Fri, 28 Oct 2022 14:19:39 -0600
+Subject: [PATCH 2/2] Disable -Wcast-function-type-strict
+
+https://github.com/harfbuzz/harfbuzz/pull/3859#issuecomment-1295409126
+---
+ src/hb.hh | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/hb.hh b/src/hb.hh
+index b9f5f7141..32838ff9b 100644
+--- a/src/hb.hh
++++ b/src/hb.hh
+@@ -126,6 +126,7 @@
+ /* Ignored intentionally. */
+ #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
+ #pragma GCC diagnostic ignored "-Wclass-memaccess"
++#pragma GCC diagnostic ignored "-Wcast-function-type-strict" // https://github.com/harfbuzz/harfbuzz/pull/3859#issuecomment-1295409126
+ #pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ #pragma GCC diagnostic ignored "-Wformat-zero-length"
+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+-- 
+2.25.1
+


=====================================
contrib/src/harfbuzz/rules.mak
=====================================
@@ -15,6 +15,8 @@ $(TARBALLS)/harfbuzz-$(HARFBUZZ_VERSION).tar.xz:
 harfbuzz: harfbuzz-$(HARFBUZZ_VERSION).tar.xz .sum-harfbuzz
 	$(UNPACK)
 	$(APPLY) $(SRC)/harfbuzz/0001-meson-Enable-big-objects-support-when-building-for-w.patch
+	$(APPLY) $(SRC)/harfbuzz/0001-freetype-Fix-function-signatures-to-match-without-ca.patch
+	$(APPLY) $(SRC)/harfbuzz/0002-Disable-Wcast-function-type-strict.patch
 	$(MOVE)
 
 DEPS_harfbuzz = freetype2 $(DEPS_freetype2)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e1a0b765c596c745a580db29ec27aacd07e6baf

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e1a0b765c596c745a580db29ec27aacd07e6baf
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list