git: 0f85c4d7e4ce - main - devel/p5-IO-Tty: fix build with clang 15

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 18 Dec 2022 17:43:43 UTC
The branch main has been updated by dim (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=0f85c4d7e4ceb4237ff6562a6b97c7051db01bf0

commit 0f85c4d7e4ceb4237ff6562a6b97c7051db01bf0
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-07 17:46:31 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-18 17:24:57 +0000

    devel/p5-IO-Tty: fix build with clang 15
    
    During an exp-run for llvm 15 (see bug 265425), it turned out that
    devel/p5-IO-Tty failed to build with clang 15:
    
      Tty.xs:190:1: error: static declaration of 'strlcpy' follows non-static declaration
      strlcpy(dst, src, siz)
      ^
      /usr/include/string.h:99:9: note: previous declaration is here
      size_t   strlcpy(char * __restrict, const char * __restrict, size_t);
               ^
    
    This is because strlcpy() and various other functions are not correctly
    detected at configure time:
    
      Looking for _getpty()...... not found.
      Looking for getpt()........ not found.
      Looking for grantpt()...... not found.
      Looking for openpty()...... not found.
      Looking for posix_openpt(). not found.
      Looking for ptsname()...... not found.
      Looking for ptsname_r().... not found.
      Looking for sigaction().... not found.
      Looking for strlcpy()...... not found.
      Looking for ttyname()...... not found.
      Looking for unlockpt()..... not found.
      Looking for libutil.h...... FOUND.
      Looking for pty.h.......... not found.
      Looking for sys/pty.h...... not found.
      Looking for sys/ptyio.h.... not found.
      Looking for sys/stropts.h.. not found.
      Looking for termio.h....... not found.
      Looking for termios.h...... FOUND.
      Looking for util.h......... not found.
    
    Makefile.PL contains a C fragment that is used for this detection, but
    it assigns the incorrect type to the value returned from the tested
    function. This leads to compilation errors, even if the tested function
    *is* available.
    
    Fix this by using the correct type for the variable containing the
    return value.
    
    PR:             268232
    Approved by:    portmgr (tcberner)
    MFH:            2022Q4
---
 devel/p5-IO-Tty/files/patch-Makefile.PL | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/devel/p5-IO-Tty/files/patch-Makefile.PL b/devel/p5-IO-Tty/files/patch-Makefile.PL
new file mode 100644
index 000000000000..a8901338a67e
--- /dev/null
+++ b/devel/p5-IO-Tty/files/patch-Makefile.PL
@@ -0,0 +1,11 @@
+--- Makefile.PL.orig	2021-01-22 08:02:35 UTC
++++ Makefile.PL
+@@ -146,7 +146,7 @@ char $f ();
+ /* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+ char $f ();
+-char (*f) ();
++char f;
+ 
+ #ifdef F77_DUMMY_MAIN
+ #  ifdef __cplusplus