Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2023 10:44:15 GMT
From:      Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 9f2c8360e8a2 - main - devel/rubygem-unicode: Fix build with Clang 16 and remove the workaround
Message-ID:  <202307091044.369AiFAw082578@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9f2c8360e8a2b7b39910a3d7359242338205fc15

commit 9f2c8360e8a2b7b39910a3d7359242338205fc15
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-07-09 10:25:37 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-07-09 10:25:37 +0000

    devel/rubygem-unicode: Fix build with Clang 16 and remove the workaround
    
    unicode.c:1039:20: error: incompatible function pointer types passing 'VALUE (get_categories_param *)' (aka 'unsigned long (struct _get_categories_param *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
      return rb_ensure(get_categories_internal, (VALUE)&param,
                       ^~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:25: note: passing argument to parameter 'b_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                            ^
    unicode.c:1040:20: error: incompatible function pointer types passing 'VALUE (WString *)' (aka 'unsigned long (struct _WString *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
                       get_categories_ensure, (VALUE)&wstr);
                       ^~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:62: note: passing argument to parameter 'e_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                                                                 ^
    unicode.c:1057:20: error: incompatible function pointer types passing 'VALUE (get_categories_param *)' (aka 'unsigned long (struct _get_categories_param *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
      return rb_ensure(get_categories_internal, (VALUE)&param,
                       ^~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:25: note: passing argument to parameter 'b_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                            ^
    unicode.c:1058:20: error: incompatible function pointer types passing 'VALUE (WString *)' (aka 'unsigned long (struct _WString *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
                       get_categories_ensure, (VALUE)&wstr);
                       ^~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:62: note: passing argument to parameter 'e_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                                                                 ^
    unicode.c:1227:20: error: incompatible function pointer types passing 'VALUE (get_text_elements_param *)' (aka 'unsigned long (struct _get_text_elements_param *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
      return rb_ensure(get_text_elements_internal, (VALUE)&param,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:25: note: passing argument to parameter 'b_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                            ^
    unicode.c:1228:20: error: incompatible function pointer types passing 'VALUE (WString *)' (aka 'unsigned long (struct _WString *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
                       get_text_elements_ensure, (VALUE)&wstr);
                       ^~~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/ruby-3.1/ruby/internal/iterator.h:425:62: note: passing argument to parameter 'e_proc' here
    VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                                                                 ^
    20 warnings and 6 errors generated.
---
 devel/rubygem-unicode/Makefile            |  6 ------
 devel/rubygem-unicode/files/patch-clang16 | 35 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/devel/rubygem-unicode/Makefile b/devel/rubygem-unicode/Makefile
index 2dd1cd924632..80b0f11e736c 100644
--- a/devel/rubygem-unicode/Makefile
+++ b/devel/rubygem-unicode/Makefile
@@ -11,10 +11,4 @@ LICENSE=	RUBY
 
 USES=		gem
 
-.include <bsd.port.options.mk>
-
-.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400091
-CONFIGURE_ARGS+=	--with-cflags="-Wno-error=incompatible-function-pointer-types"
-.endif
-
 .include <bsd.port.mk>
diff --git a/devel/rubygem-unicode/files/patch-clang16 b/devel/rubygem-unicode/files/patch-clang16
new file mode 100644
index 000000000000..998fecd504ff
--- /dev/null
+++ b/devel/rubygem-unicode/files/patch-clang16
@@ -0,0 +1,35 @@
+--- ext/unicode/unicode.c.orig	2023-07-03 15:50:18 UTC
++++ ext/unicode/unicode.c
+@@ -1036,8 +1036,8 @@ unicode_get_categories(VALUE obj, VALUE str)
+ #endif
+   WStr_allocWithUTF8L(&wstr, RSTRING_PTR(str), RSTRING_LEN(str));
+ 
+-  return rb_ensure(get_categories_internal, (VALUE)&param,
+-                   get_categories_ensure, (VALUE)&wstr);
++  return rb_ensure((VALUE (*)(VALUE)) get_categories_internal, (VALUE)&param,
++                   (VALUE (*)(VALUE)) get_categories_ensure, (VALUE)&wstr);
+   /* wstr will be freed in get_text_elements_ensure() */
+ }
+ 
+@@ -1054,8 +1054,8 @@ unicode_get_abbr_categories(VALUE obj, VALUE str)
+ #endif
+   WStr_allocWithUTF8L(&wstr, RSTRING_PTR(str), RSTRING_LEN(str));
+ 
+-  return rb_ensure(get_categories_internal, (VALUE)&param,
+-                   get_categories_ensure, (VALUE)&wstr);
++  return rb_ensure((VALUE (*)(VALUE)) get_categories_internal, (VALUE)&param,
++                   (VALUE (*)(VALUE)) get_categories_ensure, (VALUE)&wstr);
+   /* wstr will be freed in get_text_elements_ensure() */
+ }
+ 
+@@ -1224,8 +1224,8 @@ unicode_get_text_elements(VALUE obj, VALUE str)
+ #endif
+   WStr_allocWithUTF8L(&wstr, RSTRING_PTR(str), RSTRING_LEN(str));
+ 
+-  return rb_ensure(get_text_elements_internal, (VALUE)&param,
+-                   get_text_elements_ensure, (VALUE)&wstr);
++  return rb_ensure((VALUE (*)(VALUE)) get_text_elements_internal, (VALUE)&param,
++                   (VALUE (*)(VALUE)) get_text_elements_ensure, (VALUE)&wstr);
+   /* wstr will be freed in get_text_elements_ensure() */
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307091044.369AiFAw082578>