From 50b330fbec4f9c2f5aaa93addf7bd016d9e783f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 16 Sep 2025 13:56:22 +0000 Subject: Fix some harmless complier warnings (discovered with clang 20) --- generic/tclTestObj.c | 3 ++- generic/tclUtil.c | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index f7ea76b..7efdf5a 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1139,10 +1139,11 @@ TestobjCmd( } Tcl_SetObjResult(interp, Tcl_NewIntObj(varPtr[varIndex]->refCount)); } else if (strcmp(subCmd, "huge") == 0) { + Tcl_Obj *hugeObjPtr; if (objc != 2) { goto wrongNumArgs; } - Tcl_Obj *hugeObjPtr = Tcl_NewObj(); + hugeObjPtr = Tcl_NewObj(); hugeObjPtr->typePtr = &hugeType; hugeObjPtr->length = INT_MAX - 1; hugeObjPtr->bytes = NULL; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 55c7212..25aa062 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -152,7 +152,7 @@ const Tcl_ObjType tclEndOffsetType = { * \u000A \n NEWLINE * \u000B \v VERTICAL TAB * \u000C \f FORM FEED - * \u000D \r CARRIAGE RETURN + * \u000D \r CARRIAGE RETURN * \u0020 SPACE * * NOTE: differences between this and other places where Tcl defines a role @@ -270,7 +270,7 @@ const Tcl_ObjType tclEndOffsetType = { * * The command terminating character, * \u003b ; SEMICOLON * must be BRACEd, QUOTEd, or escaped so that it does not terminate the - * command prematurely. + * command prematurely. * * Any of the characters that begin substitutions in scripts, * \u0024 $ DOLLAR * \u005b [ OPEN BRACKET @@ -869,11 +869,11 @@ Tcl_SplitList( size = TclMaxListLength(list, -1, &end) + 1; length = end - list; - if (size >= (INT_MAX/sizeof(char *)) || - length > (INT_MAX - 1 - (size * sizeof(char *)))) { + if (size >= (INT_MAX/(int)sizeof(char *)) + || length > (INT_MAX - 1 - (size * (int)sizeof(char *)))) { if (interp) { - Tcl_SetResult( - interp, "memory allocation limit exceeded", TCL_STATIC); + Tcl_SetResult(interp, + "memory allocation limit exceeded", TCL_STATIC); } return TCL_ERROR; } @@ -1719,7 +1719,7 @@ TclTrimRight( #endif do { pp += pInc; - pInc = TclUtfToUCS4(pp, &ch1); + pInc = TclUtfToUCS4(pp, &ch1); } while (pp + pInc < p); /* @@ -1917,7 +1917,7 @@ Tcl_Concat( */ if (argc == 0) { - result = (char *) ckalloc(1); + result = (char *)ckalloc(1); result[0] = '\0'; return result; } @@ -3610,21 +3610,21 @@ TclFormatInt( * integer([+-]integer)? or end([+-]integer)?. * * Value - * TCL_OK + * TCL_OK * - * The index is stored at the address given by by 'indexPtr'. If - * 'objPtr' has the value "end", the value stored is 'endValue'. + * The index is stored at the address given by by 'indexPtr'. If + * 'objPtr' has the value "end", the value stored is 'endValue'. * - * TCL_ERROR + * TCL_ERROR * - * The value of 'objPtr' does not have one of the expected formats. If - * 'interp' is non-NULL, an error message is left in the interpreter's - * result object. + * The value of 'objPtr' does not have one of the expected formats. If + * 'interp' is non-NULL, an error message is left in the interpreter's + * result object. * * Effect * - * The object referenced by 'objPtr' is converted, as needed, to an - * integer, wide integer, or end-based-index object. + * The object referenced by 'objPtr' is converted, as needed, to an + * integer, wide integer, or end-based-index object. * *---------------------------------------------------------------------- */ -- cgit v0.12