From e42902a6194b645555fc0b504327b8141dcfcb18 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 28 May 2026 01:20:00 +0000 Subject: [PATCH] expect: set channel type to TCL_CHANNEL_VERSION_2 for llvm22 Avoid passing the ExpBlockModeProc function pointer through an object pointer type and instead move it to the proper place in the struct. Setting the channel version of expChannelType to 2 in the version field tells tcl's Tcl_ChannelBlockModeProc() to use the function pointer directly, and avoids undefined behavior. Using TCL_CHANNEL_VERSION_2 is the conservative choice, although version 5 would also work. discussed with stu tested/ok jca --- lang/expect/Makefile | 2 ++ lang/expect/patches/patch-exp_chan_c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lang/expect/Makefile b/lang/expect/Makefile index c25aab93a3e..faf39f96515 100644 --- a/lang/expect/Makefile +++ b/lang/expect/Makefile @@ -1,6 +1,8 @@ COMMENT = sophisticated scripter based on Tcl/Tk VERSION = 5.45.4 +REVISION = 0 + DISTNAME = expect${VERSION} PKGNAME = expect-${VERSION} SHARED_LIBS = expect5454 0.0 diff --git a/lang/expect/patches/patch-exp_chan_c b/lang/expect/patches/patch-exp_chan_c index a9e7e01fb36..b3005126861 100644 --- a/lang/expect/patches/patch-exp_chan_c +++ b/lang/expect/patches/patch-exp_chan_c @@ -1,7 +1,10 @@ Get rid of implicit declaration of function warning ---- exp_chan.c.orig Thu Sep 9 19:29:43 2010 -+++ exp_chan.c Thu Sep 9 19:30:27 2010 +error: incompatible pointer types initializing 'Tcl_ChannelTypeVersion' (aka 'struct Tcl_ChannelTypeVersion_ *') with an expression of type 'int (ClientData, int)' (aka 'int (void *, int)') [-Wincompatible-pointer-types] + +Index: exp_chan.c +--- exp_chan.c.orig ++++ exp_chan.c @@ -37,6 +37,7 @@ #include "exp_log.h" #include "tcldbg.h" /* Dbg_StdinMode */ @@ -10,3 +13,20 @@ Get rid of implicit declaration of function warning extern int expSetBlockModeProc _ANSI_ARGS_((int fd, int mode)); static int ExpBlockModeProc _ANSI_ARGS_((ClientData instanceData, int mode)); +@@ -58,7 +59,7 @@ static int ExpGetHandleProc _ANSI_ARGS_((ClientData i + + Tcl_ChannelType expChannelType = { + "exp", /* Type name. */ +- ExpBlockModeProc, /* Set blocking/nonblocking mode.*/ ++ TCL_CHANNEL_VERSION_2, /* Version. */ + ExpCloseProc, /* Close proc. */ + ExpInputProc, /* Input proc. */ + ExpOutputProc, /* Output proc. */ +@@ -68,6 +69,7 @@ Tcl_ChannelType expChannelType = { + ExpWatchProc, /* Initialize notifier. */ + ExpGetHandleProc, /* Get OS handles out of channel. */ + NULL, /* Close2 proc */ ++ ExpBlockModeProc, /* Set blocking/nonblocking mode.*/ + }; + + typedef struct ThreadSpecificData {