summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-10 11:35:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-10 11:35:22 (GMT)
commit462e3dd262738368000603e841b1365c4dc115b4 (patch)
treee8557f9e56e50c6429873b660c678861761fbe42
parenta74d73bc13dd4961d02d3974912000145bff5d1a (diff)
downloadtcl-462e3dd262738368000603e841b1365c4dc115b4.zip
tcl-462e3dd262738368000603e841b1365c4dc115b4.tar.gz
tcl-462e3dd262738368000603e841b1365c4dc115b4.tar.bz2
Proposed fix for [8ab8a138c9]: Do not pass incompatible function pointers to Tcl_EventuallyFree().
This should eliminate all warnings when using -fsanitize=function.
-rw-r--r--generic/tclBasic.c7
-rw-r--r--generic/tclIORChan.c9
-rw-r--r--generic/tclIORTrans.c17
3 files changed, 18 insertions, 15 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 9d84de2..f46a778 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -136,7 +136,7 @@ static int CancelEvalProc(ClientData clientData,
Tcl_Interp *interp, int code);
static int CheckDoubleResult(Tcl_Interp *interp, double dResult);
static void DeleteCoroutine(ClientData clientData);
-static void DeleteInterpProc(Tcl_Interp *interp);
+static void DeleteInterpProc(void *blockPtr);
static void DeleteOpCmdClientData(ClientData clientData);
#ifdef USE_DTRACE
static Tcl_ObjCmdProc DTraceObjCmd;
@@ -1392,7 +1392,7 @@ Tcl_DeleteInterp(
* Ensure that the interpreter is eventually deleted.
*/
- Tcl_EventuallyFree(interp, (Tcl_FreeProc *) DeleteInterpProc);
+ Tcl_EventuallyFree(interp, (Tcl_FreeProc *)(void *)DeleteInterpProc);
}
/*
@@ -1418,8 +1418,9 @@ Tcl_DeleteInterp(
static void
DeleteInterpProc(
- Tcl_Interp *interp) /* Interpreter to delete. */
+ void *blockPtr) /* Interpreter to delete. */
{
+ Tcl_Interp *interp = (Tcl_Interp *) blockPtr;
Interp *iPtr = (Interp *) interp;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 3eca3f8..792cf80 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -430,7 +430,7 @@ static Tcl_Obj * DecodeEventMask(int mask);
static ReflectedChannel * NewReflectedChannel(Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj, int mode, Tcl_Obj *handleObj);
static Tcl_Obj * NextHandle(void);
-static void FreeReflectedChannel(ReflectedChannel *rcPtr);
+static void FreeReflectedChannel(void *blockPtr);
static int InvokeTclMethod(ReflectedChannel *rcPtr,
MethodName method, Tcl_Obj *argOneObj,
Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr);
@@ -1170,7 +1170,7 @@ ReflectClose(
ckfree((char *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel);
+ Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *)(void *)FreeReflectedChannel);
return EOK;
}
@@ -1239,7 +1239,7 @@ ReflectClose(
ckfree((char *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel);
+ Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *)(void *)FreeReflectedChannel);
return (result == TCL_OK) ? EOK : EINVAL;
}
@@ -2210,8 +2210,9 @@ NextHandle(void)
static void
FreeReflectedChannel(
- ReflectedChannel *rcPtr)
+ void *blockPtr)
{
+ ReflectedChannel *rcPtr = (ReflectedChannel *) blockPtr;
Channel *chanPtr = (Channel *) rcPtr->chan;
TclChannelRelease((Tcl_Channel)chanPtr);
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index 730820e..d8d8b25 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -417,7 +417,7 @@ static ReflectedTransform * NewReflectedTransform(Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj, int mode, Tcl_Obj *handleObj,
Tcl_Channel parentChan);
static Tcl_Obj * NextHandle(void);
-static void FreeReflectedTransform(ReflectedTransform *rtPtr);
+static void FreeReflectedTransform(void *blockPtr);
static void FreeReflectedTransformArgs(ReflectedTransform *rtPtr);
static int InvokeTclMethod(ReflectedTransform *rtPtr,
const char *method, Tcl_Obj *argOneObj,
@@ -718,7 +718,7 @@ TclChanPushObjCmd(
* structure.
*/
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *)(void *)FreeReflectedTransform);
return TCL_ERROR;
#undef CHAN
@@ -924,7 +924,7 @@ ReflectClose(
}
#endif /* TCL_THREADS */
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *)(void *)FreeReflectedTransform);
return EOK;
}
@@ -941,7 +941,7 @@ ReflectClose(
#ifdef TCL_THREADS
if (rtPtr->thread != Tcl_GetCurrentThread()) {
Tcl_EventuallyFree(rtPtr,
- (Tcl_FreeProc *) FreeReflectedTransform);
+ (Tcl_FreeProc *)(void *)FreeReflectedTransform);
return errorCode;
}
#endif /* TCL_THREADS */
@@ -955,7 +955,7 @@ ReflectClose(
#ifdef TCL_THREADS
if (rtPtr->thread != Tcl_GetCurrentThread()) {
Tcl_EventuallyFree(rtPtr,
- (Tcl_FreeProc *) FreeReflectedTransform);
+ (Tcl_FreeProc *)(void *)FreeReflectedTransform);
return errorCode;
}
#endif /* TCL_THREADS */
@@ -975,7 +975,7 @@ ReflectClose(
ForwardOpToOwnerThread(rtPtr, ForwardedClose, &p);
result = p.base.code;
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *)(void *)FreeReflectedTransform);
if (result != TCL_OK) {
PassReceivedErrorInterp(interp, &p);
@@ -1034,7 +1034,7 @@ ReflectClose(
#endif /* TCL_THREADS */
}
- Tcl_EventuallyFree (rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *)(void *)FreeReflectedTransform);
return errorCodeSet ? errorCode : ((result == TCL_OK) ? EOK : EINVAL);
}
@@ -1920,8 +1920,9 @@ FreeReflectedTransformArgs(
static void
FreeReflectedTransform(
- ReflectedTransform *rtPtr)
+ void *blockPtr)
{
+ ReflectedTransform *rtPtr = (ReflectedTransform *) blockPtr;
TimerKill(rtPtr);
ResultClear(&rtPtr->result);