Skip to content

Commit

Permalink
textproc/p5-SGML-Parser-OpenSP: Fix build with Perl 5.38
Browse files Browse the repository at this point in the history
When 5.38 is default perl5 version, build of this port fails as
following.

--- OpenSP.c ---
Warning: Found a 'CODE' section which seems to be using 'RETVAL' but no 'OUTPUT' section. in OpenSP.xs, line 1178
mv OpenSP.xsc OpenSP.c
--- OpenSP.o ---
c++ -c  -I/usr/local/include  -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing    -DVERSION=\"0.994\"  -DXS_VERSION=\"0.994\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.38/mach/CORE"  -DSP_MULTI_BYTE=1 OpenSP.c
c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
OpenSP.xs:165:17: error: use of undeclared identifier 'uvuni_to_utf8_flags'
            d = uvuni_to_utf8_flags(d, s.ptr[i], 0);
                ^
OpenSP.xs:174:17: error: use of undeclared identifier 'uvuni_to_utf8_flags'
            d = uvuni_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0);
                ^
2 errors generated.
*** [OpenSP.o] Error code 1

make[1]: stopped in /usr0/freebsd/ports/work/usr/ports/textproc/p5-SGML-Parser-OpenSP/work/SGML-Parser-OpenSP-0.994
1 error

make[1]: stopped in /usr0/freebsd/ports/work/usr/ports/textproc/p5-SGML-Parser-OpenSP/work/SGML-Parser-OpenSP-0.994
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/textproc/p5-SGML-Parser-OpenSP

In the perlintern(1) man pages of perl 5.36.1, there are sentences as
following.

"uvuni_to_utf8_flags"
   "DEPRECATED!"  It is	planned	to remove "uvuni_to_utf8_flags"	from a
   future release of Perl.  Do not use it for new code;	remove it from
   existing code.

   Instead you almost certainly	want to	use "uvchr_to_utf8" in perlapi
   or "uvchr_to_utf8_flags" in perlapi.

   This	function is a deprecated synonym for "uvoffuni_to_utf8_flags",
   which itself, while not deprecated, should be used only in isolated
   circumstances.  These functions were	useful for code	that wanted to
   handle both EBCDIC and ASCII	platforms with Unicode properties, but
   starting in Perl v5.20, the distinctions between the	platforms have
   mostly been made invisible to most code, so this function is	quite
   unlikely to be what you want.

   U8*	 uvuni_to_utf8_flags(U8	*d, UV uv, UV flags)

So it seems planned removal finally happend with 5.38.

There are two occurrences of uvuni_to_utf8_flags in OpenSP.xs. So fix
build by replacing them with uvchr_to_utf8_flags.

PR:		272364
Approved by:	maintainer
MFH:		2023Q3
  • Loading branch information
Yasuhiro Kimura authored and Yasuhiro Kimura committed Jul 5, 2023
1 parent e95c4be commit c279190
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion textproc/p5-SGML-Parser-OpenSP/Makefile
@@ -1,6 +1,6 @@
PORTNAME= SGML-Parser-OpenSP
PORTVERSION= 0.994
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= textproc perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-
Expand Down
20 changes: 20 additions & 0 deletions textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
@@ -0,0 +1,20 @@
--- OpenSP.xs.orig 2023-07-04 14:18:21 UTC
+++ OpenSP.xs
@@ -162,7 +162,7 @@ SV* SgmlParserOpenSP::cs2sv(const SGMLApplication::Cha
{
d = m_temp;
for (i = 0; i < s.len; ++i)
- d = uvuni_to_utf8_flags(d, s.ptr[i], 0);
+ d = uvchr_to_utf8_flags(d, s.ptr[i], 0);
result = newSVpvn((const char*)m_temp, d - m_temp);
}
else
@@ -171,7 +171,7 @@ SV* SgmlParserOpenSP::cs2sv(const SGMLApplication::Cha
for (i = 0; i < s.len; ++i)
{
d = (U8 *)SvGROW(result, SvCUR(result) + UTF8_MAXLEN + 1);
- d = uvuni_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0);
+ d = uvchr_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0);
SvCUR_set(result, d - (U8 *)SvPVX(result));
}
}

0 comments on commit c279190

Please sign in to comment.