From c0a807097346d519940330d1ed1ae11c4fe9af22 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 26 Oct 2023 20:08:53 +0000 Subject: Final fix for [8ab8a138c9]: functions passed to Tcl_EventuallyFree() must be declared/defined as Tcl_FreeProc. Don't try to suppress the warning any more, as it even confuses UBSan more than that it helps --- generic/tclDecls.h | 8 --- generic/tclTest.c | 178 ++++++++++++++++++++++++++--------------------------- 2 files changed, 89 insertions(+), 97 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 78eba87..0fe582e 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4149,14 +4149,6 @@ extern const TclStubs *tclStubsPtr; # define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp)) # define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \ (tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags)) -#ifndef __cplusplus -# undef Tcl_EventuallyFree -# define Tcl_EventuallyFree \ - ((void (*)(void *,void *))(void *)(tclStubsPtr->tcl_EventuallyFree)) /* 132 */ -# undef Tcl_SetResult -# define Tcl_SetResult \ - ((void (*)(Tcl_Interp *, char *, void *))(void *)(tclStubsPtr->tcl_SetResult)) /* 232 */ -#endif #endif #if defined(_WIN32) && defined(UNICODE) diff --git a/generic/tclTest.c b/generic/tclTest.c index 6cd29f2..f4ae941 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -882,7 +882,7 @@ TestasyncCmd( if (argc < 2) { wrongNumArgs: - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -971,7 +971,7 @@ TestasyncCmd( if (Tcl_CreateThread(&threadID, AsyncThreadProc, INT2PTR(id), TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) { - Tcl_AppendResult(interp, "can't create thread", NULL); + Tcl_AppendResult(interp, "can't create thread", (void *)NULL); Tcl_MutexUnlock(&asyncTestMutex); return TCL_ERROR; } @@ -981,7 +981,7 @@ TestasyncCmd( Tcl_MutexUnlock(&asyncTestMutex); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be create, delete, int, mark, or marklater", NULL); + "\": must be create, delete, int, mark, or marklater", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -1141,17 +1141,17 @@ TestcmdinfoObjCmd( break; case CMDINFO_GET: if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[2]), &info) ==0) { - Tcl_AppendResult(interp, "??", NULL); + Tcl_AppendResult(interp, "??", (void *)NULL); return TCL_OK; } if (info.proc == CmdProc1) { Tcl_AppendResult(interp, "CmdProc1", " ", - (char *) info.clientData, NULL); + (char *) info.clientData, (void *)NULL); } else if (info.proc == CmdProc2) { Tcl_AppendResult(interp, "CmdProc2", " ", - (char *) info.clientData, NULL); + (char *) info.clientData, (void *)NULL); } else { - Tcl_AppendResult(interp, "unknown", NULL); + Tcl_AppendResult(interp, "unknown", (void *)NULL); } if (info.deleteProc == CmdDelProc1) { Tcl_AppendResult(interp, " CmdDelProc1", " ", @@ -1160,15 +1160,15 @@ TestcmdinfoObjCmd( Tcl_AppendResult(interp, " CmdDelProc2", " ", (char *) info.deleteData, NULL); } else { - Tcl_AppendResult(interp, " unknown", NULL); + Tcl_AppendResult(interp, " unknown", (void *)NULL); } - Tcl_AppendResult(interp, " ", info.namespacePtr->fullName, NULL); + Tcl_AppendResult(interp, " ", info.namespacePtr->fullName, (void *)NULL); if (info.isNativeObjectProc == 0) { - Tcl_AppendResult(interp, " stringProc", NULL); + Tcl_AppendResult(interp, " stringProc", (void *)NULL); } else if (info.isNativeObjectProc == 1) { - Tcl_AppendResult(interp, " nativeObjectProc", NULL); + Tcl_AppendResult(interp, " nativeObjectProc", (void *)NULL); } else if (info.isNativeObjectProc == 2) { - Tcl_AppendResult(interp, " nativeObjectProc2", NULL); + Tcl_AppendResult(interp, " nativeObjectProc2", (void *)NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf("Invalid isNativeObjectProc value %d", info.isNativeObjectProc)); @@ -1204,7 +1204,7 @@ CmdProc0( TCL_UNUSED(const char **) /*argv*/) { TestCommandTokenRef *refPtr = (TestCommandTokenRef *) clientData; - Tcl_AppendResult(interp, "CmdProc1 ", refPtr->value, NULL); + Tcl_AppendResult(interp, "CmdProc1 ", refPtr->value, (void *)NULL); return TCL_OK; } @@ -1215,7 +1215,7 @@ CmdProc1( TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) { - Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData, NULL); + Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData, (void *)NULL); return TCL_OK; } @@ -1226,7 +1226,7 @@ CmdProc2( TCL_UNUSED(int) /*argc*/, TCL_UNUSED(const char **) /*argv*/) { - Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData, NULL); + Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData, (void *)NULL); return TCL_OK; } @@ -1300,7 +1300,7 @@ TestcmdtokenCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " option arg\"", NULL); + " option arg\"", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -1317,7 +1317,7 @@ TestcmdtokenCmd( } else { if (sscanf(argv[2], "%d", &id) != 1) { Tcl_AppendResult(interp, "bad command token \"", argv[2], - "\"", NULL); + "\"", (void *)NULL); return TCL_ERROR; } @@ -1330,7 +1330,7 @@ TestcmdtokenCmd( if (refPtr == NULL) { Tcl_AppendResult(interp, "bad command token \"", argv[2], - "\"", NULL); + "\"", (void *)NULL); return TCL_ERROR; } @@ -1346,7 +1346,7 @@ TestcmdtokenCmd( Tcl_DecrRefCount(objPtr); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be create, name, or free", NULL); + "\": must be create, name, or free", (void *)NULL); return TCL_ERROR; } } @@ -1384,7 +1384,7 @@ TestcmdtraceCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " option script\"", NULL); + " option script\"", (void *)NULL); return TCL_ERROR; } @@ -1394,7 +1394,7 @@ TestcmdtraceCmd( result = Tcl_EvalEx(interp, argv[2], TCL_INDEX_NONE, 0); if (result == TCL_OK) { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), NULL); + Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), (void *)NULL); } Tcl_DeleteTrace(interp, cmdTrace); Tcl_DStringFree(&buffer); @@ -1416,7 +1416,7 @@ TestcmdtraceCmd( result = Tcl_EvalEx(interp, argv[2], TCL_INDEX_NONE, 0); if (result == TCL_OK) { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), NULL); + Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), (void *)NULL); } Tcl_DeleteTrace(interp, cmdTrace); Tcl_DStringFree(&buffer); @@ -1434,7 +1434,7 @@ TestcmdtraceCmd( result = Tcl_EvalEx(interp, argv[2], TCL_INDEX_NONE, 0); Tcl_DeleteTrace(interp, cmdTrace); if (!deleteCalled) { - Tcl_AppendResult(interp, "Delete wasn't called", NULL); + Tcl_AppendResult(interp, "Delete wasn't called", (void *)NULL); return TCL_ERROR; } else { return result; @@ -1448,14 +1448,14 @@ TestcmdtraceCmd( result = Tcl_EvalEx(interp, argv[2], TCL_INDEX_NONE, 0); if (result == TCL_OK) { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), NULL); + Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), (void *)NULL); } Tcl_DeleteTrace(interp, t2); Tcl_DeleteTrace(interp, t1); Tcl_DStringFree(&buffer); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be tracetest, deletetest, doubletest or resulttest", NULL); + "\": must be tracetest, deletetest, doubletest or resulttest", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -1573,7 +1573,7 @@ TestcreatecommandCmd( { if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " option\"", NULL); + " option\"", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -1588,7 +1588,7 @@ TestcreatecommandCmd( Tcl_DeleteCommand(interp, "value:at:"); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be create, delete, create2, or delete2", NULL); + "\": must be create, delete, create2, or delete2", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -1612,7 +1612,7 @@ CreatedCommandProc( return TCL_ERROR; } Tcl_AppendResult(interp, "CreatedCommandProc in ", - info.namespacePtr->fullName, NULL); + info.namespacePtr->fullName, (void *)NULL); return TCL_OK; } @@ -1629,11 +1629,11 @@ CreatedCommandProc2( found = Tcl_GetCommandInfo(interp, "value:at:", &info); if (!found) { Tcl_AppendResult(interp, "CreatedCommandProc2 could not get command info for test_ns_basic::createdcommand", - NULL); + (void *)NULL); return TCL_ERROR; } Tcl_AppendResult(interp, "CreatedCommandProc2 in ", - info.namespacePtr->fullName, NULL); + info.namespacePtr->fullName, (void *)NULL); return TCL_OK; } @@ -1729,7 +1729,7 @@ TestdelCmd( Tcl_Interp *child; if (argc != 4) { - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } @@ -1757,7 +1757,7 @@ DelCmdProc( { DelCmd *dPtr = (DelCmd *) clientData; - Tcl_AppendResult(interp, dPtr->deleteCmd, NULL); + Tcl_AppendResult(interp, dPtr->deleteCmd, (void *)NULL); ckfree(dPtr->deleteCmd); ckfree(dPtr); return TCL_OK; @@ -1802,7 +1802,7 @@ TestdelassocdataCmd( { if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " data_key\"", NULL); + " data_key\"", (void *)NULL); return TCL_ERROR; } Tcl_DeleteAssocData(interp, argv[1]); @@ -1928,7 +1928,7 @@ TestdstringCmd( if (argc < 2) { wrongNumArgs: - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "append") == 0) { @@ -1964,9 +1964,9 @@ TestdstringCmd( goto wrongNumArgs; } if (strcmp(argv[2], "staticsmall") == 0) { - Tcl_AppendResult(interp, "short", NULL); + Tcl_AppendResult(interp, "short", (void *)NULL); } else if (strcmp(argv[2], "staticlarge") == 0) { - Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL); + Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", (void *)NULL); } else if (strcmp(argv[2], "free") == 0) { char *s = (char *)ckalloc(100); strcpy(s, "This is a malloc-ed string"); @@ -1978,7 +1978,7 @@ TestdstringCmd( } else { Tcl_AppendResult(interp, "bad gresult option \"", argv[2], "\": must be staticsmall, staticlarge, free, or special", - NULL); + (void *)NULL); return TCL_ERROR; } Tcl_DStringGetResult(interp, &dstring); @@ -2014,7 +2014,7 @@ TestdstringCmd( } else { Tcl_AppendResult(interp, "bad option \"", argv[1], "\": must be append, element, end, free, get, gresult, length, " - "result, start, toobj, or trunc", NULL); + "result, start, toobj, or trunc", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -2485,7 +2485,7 @@ TestevalexObjCmd( const char *global = Tcl_GetString(objv[2]); if (strcmp(global, "global") != 0) { Tcl_AppendResult(interp, "bad value \"", global, - "\": must be global", NULL); + "\": must be global", (void *)NULL); return TCL_ERROR; } flags = TCL_EVAL_GLOBAL; @@ -2754,7 +2754,7 @@ TestexithandlerCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " create|delete value\"", NULL); + " create|delete value\"", (void *)NULL); return TCL_ERROR; } if (Tcl_GetInt(interp, argv[2], &value) != TCL_OK) { @@ -2768,7 +2768,7 @@ TestexithandlerCmd( INT2PTR(value)); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be create or delete", NULL); + "\": must be create or delete", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -2832,7 +2832,7 @@ TestexprlongCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " expression\"", NULL); + " expression\"", (void *)NULL); return TCL_ERROR; } Tcl_AppendResult(interp, "This is a result", NULL); @@ -2841,7 +2841,7 @@ TestexprlongCmd( return result; } snprintf(buf, sizeof(buf), ": %ld", exprResult); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } @@ -2877,13 +2877,13 @@ TestexprlongobjCmd( Tcl_WrongNumArgs(interp, 1, objv, "expression"); return TCL_ERROR; } - Tcl_AppendResult(interp, "This is a result", NULL); + Tcl_AppendResult(interp, "This is a result", (void *)NULL); result = Tcl_ExprLongObj(interp, objv[1], &exprResult); if (result != TCL_OK) { return result; } snprintf(buf, sizeof(buf), ": %ld", exprResult); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } @@ -2917,17 +2917,17 @@ TestexprdoubleCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " expression\"", NULL); + " expression\"", (void *)NULL); return TCL_ERROR; } - Tcl_AppendResult(interp, "This is a result", NULL); + Tcl_AppendResult(interp, "This is a result", (void *)NULL); result = Tcl_ExprDouble(interp, argv[1], &exprResult); if (result != TCL_OK) { return result; } strcpy(buf, ": "); Tcl_PrintDouble(interp, exprResult, buf+2); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } @@ -2963,14 +2963,14 @@ TestexprdoubleobjCmd( Tcl_WrongNumArgs(interp, 1, objv, "expression"); return TCL_ERROR; } - Tcl_AppendResult(interp, "This is a result", NULL); + Tcl_AppendResult(interp, "This is a result", (void *)NULL); result = Tcl_ExprDoubleObj(interp, objv[1], &exprResult); if (result != TCL_OK) { return result; } strcpy(buf, ": "); Tcl_PrintDouble(interp, exprResult, buf+2); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } @@ -2999,7 +2999,7 @@ TestexprstringCmd( { if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " expression\"", NULL); + " expression\"", (void *)NULL); return TCL_ERROR; } return Tcl_ExprString(interp, argv[1]); @@ -3048,7 +3048,7 @@ TestfilelinkCmd( Tcl_AppendResult(interp, "could not create link from \"", Tcl_GetString(objv[1]), "\" to \"", Tcl_GetString(objv[2]), "\": ", - Tcl_PosixError(interp), NULL); + Tcl_PosixError(interp), (void *)NULL); return TCL_ERROR; } } else { @@ -3057,7 +3057,7 @@ TestfilelinkCmd( if (contents == NULL) { Tcl_AppendResult(interp, "could not read link \"", Tcl_GetString(objv[1]), "\": ", - Tcl_PosixError(interp), NULL); + Tcl_PosixError(interp), (void *)NULL); return TCL_ERROR; } } @@ -3100,12 +3100,12 @@ TestgetassocdataCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " data_key\"", NULL); + " data_key\"", (void *)NULL); return TCL_ERROR; } res = (char *) Tcl_GetAssocData(interp, argv[1], NULL); if (res != NULL) { - Tcl_AppendResult(interp, res, NULL); + Tcl_AppendResult(interp, res, (void *)NULL); } return TCL_OK; } @@ -3141,11 +3141,11 @@ TestgetplatformCmd( if (argc != 1) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - NULL); + (void *)NULL); return TCL_ERROR; } - Tcl_AppendResult(interp, platformStrings[*platform], NULL); + Tcl_AppendResult(interp, platformStrings[*platform], (void *)NULL); return TCL_OK; } @@ -3178,7 +3178,7 @@ TestinterpdeleteCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " path\"", NULL); + " path\"", (void *)NULL); return TCL_ERROR; } childToDelete = Tcl_GetChild(interp, argv[1]); @@ -3236,7 +3236,7 @@ TestlinkCmd( if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " option ?arg arg arg arg arg arg arg arg arg arg arg arg" - " arg arg?\"", NULL); + " arg arg?\"", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -3244,7 +3244,7 @@ TestlinkCmd( Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " ", argv[1], " intRO realRO boolRO stringRO wideRO charRO ucharRO shortRO" - " ushortRO uintRO longRO ulongRO floatRO uwideRO\"", NULL); + " ushortRO uintRO longRO ulongRO floatRO uwideRO\"", (void *)NULL); return TCL_ERROR; } if (created) { @@ -3453,7 +3453,7 @@ TestlinkCmd( argv[0], " ", argv[1], " intValue realValue boolValue stringValue wideValue" " charValue ucharValue shortValue ushortValue uintValue" - " longValue ulongValue floatValue uwideValue\"", NULL); + " longValue ulongValue floatValue uwideValue\"", (void *)NULL); return TCL_ERROR; } if (argv[2][0] != 0) { @@ -3557,7 +3557,7 @@ TestlinkCmd( argv[0], " ", argv[1], " intValue realValue boolValue stringValue wideValue" " charValue ucharValue shortValue ushortValue uintValue" - " longValue ulongValue floatValue uwideValue\"", NULL); + " longValue ulongValue floatValue uwideValue\"", (void *)NULL); return TCL_ERROR; } if (argv[2][0] != 0) { @@ -3669,7 +3669,7 @@ TestlinkCmd( } } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": should be create, delete, get, set, or update", NULL); + "\": should be create, delete, get, set, or update", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -3868,7 +3868,7 @@ TestlistrepCmd( } resultObj = TclListTestObj(length, leadSpace, endSpace); if (resultObj == NULL) { - Tcl_AppendResult(interp, "List capacity exceeded", NULL); + Tcl_AppendResult(interp, "List capacity exceeded", (void *)NULL); return TCL_ERROR; } } @@ -4565,7 +4565,7 @@ TestregexpObjCmd( value = Tcl_SetVar2(interp, varName, NULL, resinfo, 0); if (value == NULL) { Tcl_AppendResult(interp, "couldn't set variable \"", - varName, "\"", NULL); + varName, "\"", (void *)NULL); return TCL_ERROR; } } else if (cflags & TCL_REG_CANMATCH) { @@ -4579,7 +4579,7 @@ TestregexpObjCmd( value = Tcl_SetVar2(interp, varName, NULL, resinfo, 0); if (value == NULL) { Tcl_AppendResult(interp, "couldn't set variable \"", - varName, "\"", NULL); + varName, "\"", (void *)NULL); return TCL_ERROR; } } @@ -4800,7 +4800,7 @@ TestsetassocdataCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " data_key data_item\"", NULL); + " data_key data_item\"", (void *)NULL); return TCL_ERROR; } @@ -4853,7 +4853,7 @@ TestsetplatformCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], - " platform\"", NULL); + " platform\"", (void *)NULL); return TCL_ERROR; } @@ -4864,7 +4864,7 @@ TestsetplatformCmd( *platform = TCL_PLATFORM_WINDOWS; } else { Tcl_AppendResult(interp, "unsupported platform: should be one of " - "unix, or windows", NULL); + "unix, or windows", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -4899,7 +4899,7 @@ TeststaticlibraryCmd( if (argc != 4) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", - argv[0], " prefix safe loaded\"", NULL); + argv[0], " prefix safe loaded\"", (void *)NULL); return TCL_ERROR; } if (Tcl_GetInt(interp, argv[2], &safe) != TCL_OK) { @@ -4951,14 +4951,14 @@ TesttranslatefilenameCmd( if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", - argv[0], " path\"", NULL); + argv[0], " path\"", (void *)NULL); return TCL_ERROR; } result = Tcl_TranslateFileName(interp, argv[1], &buffer); if (result == NULL) { return TCL_ERROR; } - Tcl_AppendResult(interp, result, NULL); + Tcl_AppendResult(interp, result, (void *)NULL); Tcl_DStringFree(&buffer); return TCL_OK; } @@ -4991,7 +4991,7 @@ TestupvarCmd( if ((argc != 5) && (argc != 6)) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", - argv[0], " level name ?name2? dest global\"", NULL); + argv[0], " level name ?name2? dest global\"", (void *)NULL); return TCL_ERROR; } @@ -5040,7 +5040,7 @@ TestseterrorcodeCmd( const char **argv) /* Argument strings. */ { if (argc > 6) { - Tcl_AppendResult(interp, "too many args", NULL); + Tcl_AppendResult(interp, "too many args", (void *)NULL); return TCL_ERROR; } switch (argc) { @@ -5125,13 +5125,13 @@ TestfeventCmd( if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " option ?arg ...?", NULL); + " option ?arg ...?", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[1], "cmd") == 0) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " cmd script", NULL); + " cmd script", (void *)NULL); return TCL_ERROR; } if (interp2 != NULL) { @@ -5141,7 +5141,7 @@ TestfeventCmd( } else { Tcl_AppendResult(interp, "called \"testfevent code\" before \"testfevent create\"", - NULL); + (void *)NULL); return TCL_ERROR; } } else if (strcmp(argv[1], "create") == 0) { @@ -5257,11 +5257,11 @@ TestfileCmd( if (result != TCL_OK) { if (error != NULL) { if (Tcl_GetString(error)[0] != '\0') { - Tcl_AppendResult(interp, Tcl_GetString(error), " ", NULL); + Tcl_AppendResult(interp, Tcl_GetString(error), " ", (void *)NULL); } Tcl_DecrRefCount(error); } - Tcl_AppendResult(interp, Tcl_ErrnoId(), NULL); + Tcl_AppendResult(interp, Tcl_ErrnoId(), (void *)NULL); } end: @@ -5702,7 +5702,7 @@ TestsetbytearraylengthObjCmd( if (obj != objv[1]) { Tcl_DecrRefCount(obj); } - Tcl_AppendResult(interp, "expected bytes", NULL); + Tcl_AppendResult(interp, "expected bytes", (void *)NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, obj); @@ -5749,7 +5749,7 @@ TestbytestringObjCmd( return TCL_ERROR; } if (x.m != 1) { - Tcl_AppendResult(interp, "Tcl_GetBytesFromObj() overwrites variable", NULL); + Tcl_AppendResult(interp, "Tcl_GetBytesFromObj() overwrites variable", (void *)NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewStringObj(p, x.n)); @@ -5821,7 +5821,7 @@ TestsetCmd( const char *value; if (argc == 2) { - Tcl_AppendResult(interp, "before get", NULL); + Tcl_AppendResult(interp, "before get", (void *)NULL); value = Tcl_GetVar2(interp, argv[1], NULL, flags); if (value == NULL) { return TCL_ERROR; @@ -5829,7 +5829,7 @@ TestsetCmd( Tcl_AppendElement(interp, value); return TCL_OK; } else if (argc == 3) { - Tcl_AppendResult(interp, "before set", NULL); + Tcl_AppendResult(interp, "before set", (void *)NULL); value = Tcl_SetVar2(interp, argv[1], NULL, argv[2], flags); if (value == NULL) { return TCL_ERROR; @@ -5838,7 +5838,7 @@ TestsetCmd( return TCL_OK; } else { Tcl_AppendResult(interp, "wrong # args: should be \"", - argv[0], " varName ?newValue?\"", NULL); + argv[0], " varName ?newValue?\"", (void *)NULL); return TCL_ERROR; } } @@ -5853,7 +5853,7 @@ Testset2Cmd( const char *value; if (argc == 3) { - Tcl_AppendResult(interp, "before get", NULL); + Tcl_AppendResult(interp, "before get", (void *)NULL); value = Tcl_GetVar2(interp, argv[1], argv[2], flags); if (value == NULL) { return TCL_ERROR; @@ -5861,7 +5861,7 @@ Testset2Cmd( Tcl_AppendElement(interp, value); return TCL_OK; } else if (argc == 4) { - Tcl_AppendResult(interp, "before set", NULL); + Tcl_AppendResult(interp, "before set", (void *)NULL); value = Tcl_SetVar2(interp, argv[1], argv[2], argv[3], flags); if (value == NULL) { return TCL_ERROR; @@ -5870,7 +5870,7 @@ Testset2Cmd( return TCL_OK; } else { Tcl_AppendResult(interp, "wrong # args: should be \"", - argv[0], " varName elemName ?newValue?\"", NULL); + argv[0], " varName elemName ?newValue?\"", (void *)NULL); return TCL_ERROR; } } @@ -6003,9 +6003,9 @@ TestsaveresultCmd( static void TestsaveresultFree( #if TCL_MAJOR_VERSION > 8 - (TCL_UNUSED void *)) + TCL_UNUSED(void *)) #else - (TCL_UNUSED char *)) + TCL_UNUSED(char *)) #endif { freeCount++; -- cgit v0.12 From da07fbe0220630931595f469782262f84303e064 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Oct 2023 15:03:27 +0000 Subject: More C++-sentinel-related fixes (hopefully, those are the last ones) --- generic/tclTest.c | 194 ++++++++++++++++++++++++------------------------ generic/tclThreadTest.c | 10 +-- unix/tclUnixTest.c | 2 +- 3 files changed, 103 insertions(+), 103 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index f4ae941..8159e19 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -5931,10 +5931,10 @@ TestsaveresultCmd( objPtr = NULL; switch ((enum options) index) { case RESULT_SMALL: - Tcl_AppendResult(interp, "small result", NULL); + Tcl_AppendResult(interp, "small result", (void *)NULL); break; case RESULT_APPEND: - Tcl_AppendResult(interp, "append result", NULL); + Tcl_AppendResult(interp, "append result", (void *)NULL); break; case RESULT_FREE: { char *buf = (char *)ckalloc(200); @@ -6042,7 +6042,7 @@ TestmainthreadCmd( Tcl_SetObjResult(interp, idObj); return TCL_OK; } else { - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } } @@ -6168,7 +6168,7 @@ TestChannelCmd( if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " subcommand ?additional args..?\"", NULL); + " subcommand ?additional args..?\"", (void *)NULL); return TCL_ERROR; } cmdName = argv[1]; @@ -6251,7 +6251,7 @@ TestChannelCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " cut channelName\"", NULL); + " cut channelName\"", (void *)NULL); return TCL_ERROR; } @@ -6274,7 +6274,7 @@ TestChannelCmd( (strncmp(cmdName, "clearchannelhandlers", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " clearchannelhandlers channelName\"", NULL); + " clearchannelhandlers channelName\"", (void *)NULL); return TCL_ERROR; } Tcl_ClearChannelHandlers(chan); @@ -6284,7 +6284,7 @@ TestChannelCmd( if ((cmdName[0] == 'i') && (strncmp(cmdName, "info", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " info channelName\"", NULL); + " info channelName\"", (void *)NULL); return TCL_ERROR; } Tcl_AppendElement(interp, argv[2]); @@ -6376,40 +6376,40 @@ TestChannelCmd( if ((cmdName[0] == 'i') && (strncmp(cmdName, "inputbuffered", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } IOQueued = Tcl_InputBuffered(chan); TclFormatInt(buf, IOQueued); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } if ((cmdName[0] == 'i') && (strncmp(cmdName, "isshared", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } TclFormatInt(buf, Tcl_IsChannelShared(chan)); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } if ((cmdName[0] == 'i') && (strncmp(cmdName, "isstandard", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } TclFormatInt(buf, Tcl_IsStandardChannel(chan)); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } if ((cmdName[0] == 'm') && (strncmp(cmdName, "mode", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6428,7 +6428,7 @@ TestChannelCmd( if ((cmdName[0] == 'm') && (strncmp(cmdName, "maxmode", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6447,7 +6447,7 @@ TestChannelCmd( if ((cmdName[0] == 'm') && (strncmp(cmdName, "mremove-rd", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6456,7 +6456,7 @@ TestChannelCmd( if ((cmdName[0] == 'm') && (strncmp(cmdName, "mremove-wr", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6465,7 +6465,7 @@ TestChannelCmd( if ((cmdName[0] == 'm') && (strncmp(cmdName, "mthread", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6476,10 +6476,10 @@ TestChannelCmd( if ((cmdName[0] == 'n') && (strncmp(cmdName, "name", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } - Tcl_AppendResult(interp, statePtr->channelName, NULL); + Tcl_AppendResult(interp, statePtr->channelName, (void *)NULL); return TCL_OK; } @@ -6499,20 +6499,20 @@ TestChannelCmd( if ((cmdName[0] == 'o') && (strncmp(cmdName, "outputbuffered", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } IOQueued = Tcl_OutputBuffered(chan); TclFormatInt(buf, IOQueued); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } if ((cmdName[0] == 'q') && (strncmp(cmdName, "queuedcr", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6540,12 +6540,12 @@ TestChannelCmd( if ((cmdName[0] == 'r') && (strncmp(cmdName, "refcount", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } TclFormatInt(buf, statePtr->refCount); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); return TCL_OK; } @@ -6558,7 +6558,7 @@ TestChannelCmd( if ((cmdName[0] == 's') && (strncmp(cmdName, "splice", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } @@ -6572,10 +6572,10 @@ TestChannelCmd( if ((cmdName[0] == 't') && (strncmp(cmdName, "type", len) == 0)) { if (argc != 3) { - Tcl_AppendResult(interp, "channel name required", NULL); + Tcl_AppendResult(interp, "channel name required", (void *)NULL); return TCL_ERROR; } - Tcl_AppendResult(interp, Tcl_ChannelName(chanPtr->typePtr), NULL); + Tcl_AppendResult(interp, Tcl_ChannelName(chanPtr->typePtr), (void *)NULL); return TCL_OK; } @@ -6602,7 +6602,7 @@ TestChannelCmd( if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " transform channelId -command cmd\"", NULL); + " transform channelId -command cmd\"", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[3], "-command") != 0) { @@ -6622,7 +6622,7 @@ TestChannelCmd( if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " unstack channel\"", NULL); + " unstack channel\"", (void *)NULL); return TCL_ERROR; } return Tcl_UnstackChannel(interp, chan); @@ -6630,7 +6630,7 @@ TestChannelCmd( Tcl_AppendResult(interp, "bad option \"", cmdName, "\": should be " "cut, clearchannelhandlers, info, isshared, mode, open, " - "readable, splice, writable, transform, unstack", NULL); + "readable, splice, writable, transform, unstack", (void *)NULL); return TCL_ERROR; } @@ -6667,7 +6667,7 @@ TestChannelEventCmd( if ((argc < 3) || (argc > 5)) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName cmd ?arg1? ?arg2?\"", NULL); + " channelName cmd ?arg1? ?arg2?\"", (void *)NULL); return TCL_ERROR; } chanPtr = (Channel *) Tcl_GetChannel(interp, argv[1], NULL); @@ -6681,7 +6681,7 @@ TestChannelEventCmd( if ((cmd[0] == 'a') && (strncmp(cmd, "add", len) == 0)) { if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName add eventSpec script\"", NULL); + " channelName add eventSpec script\"", (void *)NULL); return TCL_ERROR; } if (strcmp(argv[3], "readable") == 0) { @@ -6692,7 +6692,7 @@ TestChannelEventCmd( mask = 0; } else { Tcl_AppendResult(interp, "bad event name \"", argv[3], - "\": must be readable, writable, or none", NULL); + "\": must be readable, writable, or none", (void *)NULL); return TCL_ERROR; } @@ -6715,7 +6715,7 @@ TestChannelEventCmd( if ((cmd[0] == 'd') && (strncmp(cmd, "delete", len) == 0)) { if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName delete index\"", NULL); + " channelName delete index\"", (void *)NULL); return TCL_ERROR; } if (Tcl_GetInt(interp, argv[3], &index) == TCL_ERROR) { @@ -6723,7 +6723,7 @@ TestChannelEventCmd( } if (index < 0) { Tcl_AppendResult(interp, "bad event index: ", argv[3], - ": must be nonnegative", NULL); + ": must be nonnegative", (void *)NULL); return TCL_ERROR; } for (i = 0, esPtr = statePtr->scriptRecordPtr; @@ -6733,7 +6733,7 @@ TestChannelEventCmd( } if (esPtr == NULL) { Tcl_AppendResult(interp, "bad event index ", argv[3], - ": out of range", NULL); + ": out of range", (void *)NULL); return TCL_ERROR; } if (esPtr == statePtr->scriptRecordPtr) { @@ -6761,7 +6761,7 @@ TestChannelEventCmd( if ((cmd[0] == 'l') && (strncmp(cmd, "list", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName list\"", NULL); + " channelName list\"", (void *)NULL); return TCL_ERROR; } resultListPtr = Tcl_GetObjResult(interp); @@ -6784,7 +6784,7 @@ TestChannelEventCmd( if ((cmd[0] == 'r') && (strncmp(cmd, "removeall", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName removeall\"", NULL); + " channelName removeall\"", (void *)NULL); return TCL_ERROR; } for (esPtr = statePtr->scriptRecordPtr; @@ -6803,7 +6803,7 @@ TestChannelEventCmd( if ((cmd[0] == 's') && (strncmp(cmd, "set", len) == 0)) { if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " channelName delete index event\"", NULL); + " channelName delete index event\"", (void *)NULL); return TCL_ERROR; } if (Tcl_GetInt(interp, argv[3], &index) == TCL_ERROR) { @@ -6811,7 +6811,7 @@ TestChannelEventCmd( } if (index < 0) { Tcl_AppendResult(interp, "bad event index: ", argv[3], - ": must be nonnegative", NULL); + ": must be nonnegative", (void *)NULL); return TCL_ERROR; } for (i = 0, esPtr = statePtr->scriptRecordPtr; @@ -6821,7 +6821,7 @@ TestChannelEventCmd( } if (esPtr == NULL) { Tcl_AppendResult(interp, "bad event index ", argv[3], - ": out of range", NULL); + ": out of range", (void *)NULL); return TCL_ERROR; } @@ -6833,7 +6833,7 @@ TestChannelEventCmd( mask = 0; } else { Tcl_AppendResult(interp, "bad event name \"", argv[4], - "\": must be readable, writable, or none", NULL); + "\": must be readable, writable, or none", (void *)NULL); return TCL_ERROR; } esPtr->mask = mask; @@ -6842,7 +6842,7 @@ TestChannelEventCmd( return TCL_OK; } Tcl_AppendResult(interp, "bad command ", cmd, ", must be one of " - "add, delete, list, set, or removeall", NULL); + "add, delete, list, set, or removeall", (void *)NULL); return TCL_ERROR; } @@ -6879,7 +6879,7 @@ TestSocketCmd( if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " subcommand ?additional args..?\"", NULL); + " subcommand ?additional args..?\"", (void *)NULL); return TCL_ERROR; } cmdName = argv[1]; @@ -6896,18 +6896,18 @@ TestSocketCmd( */ if (argc < 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " testflags channel flags\"", NULL); + " testflags channel flags\"", (void *)NULL); return TCL_ERROR; } hChannel = Tcl_GetChannel(interp, argv[2], &modePtr); if ( NULL == hChannel ) { - Tcl_AppendResult(interp, "unknown channel:", argv[2], NULL); + Tcl_AppendResult(interp, "unknown channel:", argv[2], (void *)NULL); return TCL_ERROR; } statePtr = (TcpState *)Tcl_GetChannelInstanceData(hChannel); if ( NULL == statePtr) { Tcl_AppendResult(interp, "No channel instance data:", argv[2], - NULL); + (void *)NULL); return TCL_ERROR; } if (Tcl_GetBoolean(interp, argv[3], &testMode) != TCL_OK) { @@ -6922,7 +6922,7 @@ TestSocketCmd( } Tcl_AppendResult(interp, "bad option \"", cmdName, "\": should be " - "testflags", NULL); + "testflags", (void *)NULL); return TCL_ERROR; } @@ -6956,7 +6956,7 @@ TestServiceModeCmd( int newmode, oldmode; if (argc > 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " ?newmode?\"", NULL); + " ?newmode?\"", (void *)NULL); return TCL_ERROR; } oldmode = (Tcl_GetServiceMode() != TCL_SERVICE_NONE); @@ -7018,7 +7018,7 @@ TestWrongNumArgsObjCmd( * Asked for more arguments than were given. */ insufArgs: - Tcl_AppendResult(interp, "insufficient arguments", NULL); + Tcl_AppendResult(interp, "insufficient arguments", (void *)NULL); return TCL_ERROR; } @@ -7071,15 +7071,15 @@ TestGetIndexFromObjStructObjCmd( return TCL_ERROR; } if (idx[0] != 85 || idx[2] != 85) { - Tcl_AppendResult(interp, "Tcl_GetIndexFromObjStruct overwrites bytes near index variable", NULL); + Tcl_AppendResult(interp, "Tcl_GetIndexFromObjStruct overwrites bytes near index variable", (void *)NULL); return TCL_ERROR; } else if (idx[1] != target) { char buffer[64]; snprintf(buffer, sizeof(buffer), "%d", idx[1]); Tcl_AppendResult(interp, "index value comparison failed: got ", - buffer, NULL); + buffer, (void *)NULL); snprintf(buffer, sizeof(buffer), "%d", target); - Tcl_AppendResult(interp, " when ", buffer, " expected", NULL); + Tcl_AppendResult(interp, " when ", buffer, " expected", (void *)NULL); return TCL_ERROR; } Tcl_WrongNumArgs(interp, objc, objv, NULL); @@ -7586,7 +7586,7 @@ SimpleOpenFileChannel( Tcl_Channel chan; if ((mode != 0) && !(mode & O_RDONLY)) { - Tcl_AppendResult(interp, "read-only", NULL); + Tcl_AppendResult(interp, "read-only", (void *)NULL); return NULL; } @@ -7672,7 +7672,7 @@ TestUtfNextCmd( /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */ result = Tcl_UtfNext(buffer + 1); if (first != result) { - Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL); + Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", (void *)NULL); return TCL_ERROR; } } @@ -7944,7 +7944,7 @@ TestHashSystemHashCmd( Tcl_InitCustomHashTable(&hash, TCL_CUSTOM_TYPE_KEYS, &hkType); if (hash.numEntries != 0) { - Tcl_AppendResult(interp, "non-zero initial size", NULL); + Tcl_AppendResult(interp, "non-zero initial size", (void *)NULL); Tcl_DeleteHashTable(&hash); return TCL_ERROR; } @@ -7961,7 +7961,7 @@ TestHashSystemHashCmd( } if (hash.numEntries != (Tcl_Size)limit) { - Tcl_AppendResult(interp, "unexpected maximal size", NULL); + Tcl_AppendResult(interp, "unexpected maximal size", (void *)NULL); Tcl_DeleteHashTable(&hash); return TCL_ERROR; } @@ -7984,13 +7984,13 @@ TestHashSystemHashCmd( } if (hash.numEntries != 0) { - Tcl_AppendResult(interp, "non-zero final size", NULL); + Tcl_AppendResult(interp, "non-zero final size", (void *)NULL); Tcl_DeleteHashTable(&hash); return TCL_ERROR; } Tcl_DeleteHashTable(&hash); - Tcl_AppendResult(interp, "OK", NULL); + Tcl_AppendResult(interp, "OK", (void *)NULL); return TCL_OK; } @@ -8006,7 +8006,7 @@ TestgetintCmd( const char **argv) { if (argc < 2) { - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } else { int val, i, total=0; @@ -8033,7 +8033,7 @@ TestlongsizeCmd( TCL_UNUSED(const char **) /*argv*/) { if (argc != 1) { - Tcl_AppendResult(interp, "wrong # args", NULL); + Tcl_AppendResult(interp, "wrong # args", (void *)NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(sizeof(long))); @@ -8184,21 +8184,21 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (a) concatObj does not have refCount 0", NULL); + "\n\t* (a) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (a) concatObj is not a new obj ", - NULL); + (void *)NULL); switch (tmpPtr->refCount) { case 0: - Tcl_AppendResult(interp, "(no new refCount)", NULL); + Tcl_AppendResult(interp, "(no new refCount)", (void *)NULL); break; case 1: - Tcl_AppendResult(interp, "(refCount added)", NULL); + Tcl_AppendResult(interp, "(refCount added)", (void *)NULL); break; default: - Tcl_AppendResult(interp, "(more than one refCount added!)", NULL); + Tcl_AppendResult(interp, "(more than one refCount added!)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); } tmpPtr = Tcl_DuplicateObj(list1Ptr); @@ -8211,26 +8211,26 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (b) concatObj does not have refCount 0", NULL); + "\n\t* (b) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (b) concatObj is not a new obj ", - NULL); + (void *)NULL); switch (tmpPtr->refCount) { case 0: - Tcl_AppendResult(interp, "(refCount removed?)", NULL); + Tcl_AppendResult(interp, "(refCount removed?)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); break; case 1: - Tcl_AppendResult(interp, "(no new refCount)", NULL); + Tcl_AppendResult(interp, "(no new refCount)", (void *)NULL); break; case 2: - Tcl_AppendResult(interp, "(refCount added)", NULL); + Tcl_AppendResult(interp, "(refCount added)", (void *)NULL); Tcl_DecrRefCount(tmpPtr); break; default: - Tcl_AppendResult(interp, "(more than one refCount added!)", NULL); + Tcl_AppendResult(interp, "(more than one refCount added!)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); } tmpPtr = Tcl_DuplicateObj(list1Ptr); @@ -8245,21 +8245,21 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (c) concatObj does not have refCount 0", NULL); + "\n\t* (c) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (c) concatObj is not a new obj ", - NULL); + (void *)NULL); switch (tmpPtr->refCount) { case 0: - Tcl_AppendResult(interp, "(no new refCount)", NULL); + Tcl_AppendResult(interp, "(no new refCount)", (void *)NULL); break; case 1: - Tcl_AppendResult(interp, "(refCount added)", NULL); + Tcl_AppendResult(interp, "(refCount added)", (void *)NULL); break; default: - Tcl_AppendResult(interp, "(more than one refCount added!)", NULL); + Tcl_AppendResult(interp, "(more than one refCount added!)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); } tmpPtr = Tcl_DuplicateObj(list1Ptr); @@ -8272,22 +8272,22 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (d) concatObj does not have refCount 0", NULL); + "\n\t* (d) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (d) concatObj is not a new obj ", - NULL); + (void *)NULL); switch (tmpPtr->refCount) { case 0: - Tcl_AppendResult(interp, "(refCount removed?)", NULL); + Tcl_AppendResult(interp, "(refCount removed?)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); break; case 1: - Tcl_AppendResult(interp, "(no new refCount)", NULL); + Tcl_AppendResult(interp, "(no new refCount)", (void *)NULL); break; case 2: - Tcl_AppendResult(interp, "(refCount added)", NULL); + Tcl_AppendResult(interp, "(refCount added)", (void *)NULL); Tcl_DecrRefCount(tmpPtr); break; default: @@ -8310,20 +8310,20 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (e) concatObj does not have refCount 0", NULL); + "\n\t* (e) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (e) concatObj is not a new obj ", - NULL); + (void *)NULL); (void) Tcl_ListObjLength(NULL, concatPtr, &len); switch (tmpPtr->refCount) { case 3: - Tcl_AppendResult(interp, "(failed to concat)", NULL); + Tcl_AppendResult(interp, "(failed to concat)", (void *)NULL); break; default: - Tcl_AppendResult(interp, "(corrupted input!)", NULL); + Tcl_AppendResult(interp, "(corrupted input!)", (void *)NULL); } if (Tcl_IsShared(tmpPtr)) { Tcl_DecrRefCount(tmpPtr); @@ -8340,20 +8340,20 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (f) concatObj does not have refCount 0", NULL); + "\n\t* (f) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (f) concatObj is not a new obj ", - NULL); + (void *)NULL); (void) Tcl_ListObjLength(NULL, concatPtr, &len); switch (tmpPtr->refCount) { case 3: - Tcl_AppendResult(interp, "(failed to concat)", NULL); + Tcl_AppendResult(interp, "(failed to concat)", (void *)NULL); break; default: - Tcl_AppendResult(interp, "(corrupted input!)", NULL); + Tcl_AppendResult(interp, "(corrupted input!)", (void *)NULL); } if (Tcl_IsShared(tmpPtr)) { Tcl_DecrRefCount(tmpPtr); @@ -8371,20 +8371,20 @@ TestconcatobjCmd( if (concatPtr->refCount != 0) { result = TCL_ERROR; Tcl_AppendResult(interp, - "\n\t* (g) concatObj does not have refCount 0", NULL); + "\n\t* (g) concatObj does not have refCount 0", (void *)NULL); } if (concatPtr == tmpPtr) { result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (g) concatObj is not a new obj ", - NULL); + (void *)NULL); (void) Tcl_ListObjLength(NULL, concatPtr, &len); switch (tmpPtr->refCount) { case 3: - Tcl_AppendResult(interp, "(failed to concat)", NULL); + Tcl_AppendResult(interp, "(failed to concat)", (void *)NULL); break; default: - Tcl_AppendResult(interp, "(corrupted input!)", NULL); + Tcl_AppendResult(interp, "(corrupted input!)", (void *)NULL); } Tcl_DecrRefCount(tmpPtr); if (Tcl_IsShared(tmpPtr)) { @@ -8758,7 +8758,7 @@ TestInterpResolverCmd( if (objc == 3) { interp = Tcl_GetChild(interp, Tcl_GetString(objv[2])); if (interp == NULL) { - Tcl_AppendResult(interp, "provided interpreter not found", NULL); + Tcl_AppendResult(interp, "provided interpreter not found", (void *)NULL); return TCL_ERROR; } } @@ -8774,7 +8774,7 @@ TestInterpResolverCmd( case 0: /*down*/ if (!Tcl_RemoveInterpResolvers(interp, RESOLVER_KEY)) { Tcl_AppendResult(interp, "could not remove the resolver scheme", - NULL); + (void *)NULL); return TCL_ERROR; } } diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 99f9838..7b158b4 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -370,7 +370,7 @@ ThreadObjCmd( char buf[TCL_INTEGER_SPACE]; snprintf(buf, sizeof(buf), "%" TCL_LL_MODIFIER "d", (long long)id); - Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); + Tcl_AppendResult(interp, "cannot join thread ", buf, (void *)NULL); } return result; } @@ -508,7 +508,7 @@ ThreadCreate( if (Tcl_CreateThread(&id, NewTestThread, &ctrl, TCL_THREAD_STACK_DEFAULT, joinable) != TCL_OK) { Tcl_MutexUnlock(&threadMutex); - Tcl_AppendResult(interp, "can't create a new thread", NULL); + Tcl_AppendResult(interp, "can't create a new thread", (void *)NULL); return TCL_ERROR; } @@ -819,7 +819,7 @@ ThreadSend( } if (!found) { Tcl_MutexUnlock(&threadMutex); - Tcl_AppendResult(interp, "invalid thread id", NULL); + Tcl_AppendResult(interp, "invalid thread id", (void *)NULL); return TCL_ERROR; } @@ -921,7 +921,7 @@ ThreadSend( ckfree(resultPtr->errorInfo); } } - Tcl_AppendResult(interp, resultPtr->result, NULL); + Tcl_AppendResult(interp, resultPtr->result, (void *)NULL); Tcl_ConditionFinalize(&resultPtr->done); code = resultPtr->code; @@ -972,7 +972,7 @@ ThreadCancel( } if (!found) { Tcl_MutexUnlock(&threadMutex); - Tcl_AppendResult(interp, "invalid thread id", NULL); + Tcl_AppendResult(interp, "invalid thread id", (void *)NULL); return TCL_ERROR; } diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index bade827..4f052a8 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -357,7 +357,7 @@ TestfilewaitCmd( Tcl_WrongNumArgs(interp, 2, objv, "file readable|writable|both timeout"); return TCL_ERROR; } - channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), (void *)NULL); + channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL); if (channel == NULL) { return TCL_ERROR; } -- cgit v0.12 From 14ab5ccf54dac59237afc1a65d09a4a4860f197b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Oct 2023 17:13:59 +0000 Subject: [26870862f0] follow-up: of course it was not complete yet --- generic/tclTest.c | 28 ++++++++++++++-------------- generic/tclTestObj.c | 10 +++++----- generic/tclTestProcBodyObj.c | 6 +++--- generic/tclThreadTest.c | 2 +- win/tclWinDde.c | 18 +++++++++--------- win/tclWinReg.c | 6 +++--- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 8159e19..6a90b67 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1155,10 +1155,10 @@ TestcmdinfoObjCmd( } if (info.deleteProc == CmdDelProc1) { Tcl_AppendResult(interp, " CmdDelProc1", " ", - (char *) info.deleteData, NULL); + (char *) info.deleteData, (void *)NULL); } else if (info.deleteProc == CmdDelProc2) { Tcl_AppendResult(interp, " CmdDelProc2", " ", - (char *) info.deleteData, NULL); + (char *) info.deleteData, (void *)NULL); } else { Tcl_AppendResult(interp, " unknown", (void *)NULL); } @@ -1313,7 +1313,7 @@ TestcmdtokenCmd( refPtr->nextPtr = firstCommandTokenRef; firstCommandTokenRef = refPtr; snprintf(buf, sizeof(buf), "%d", refPtr->id); - Tcl_AppendResult(interp, buf, NULL); + Tcl_AppendResult(interp, buf, (void *)NULL); } else { if (sscanf(argv[2], "%d", &id) != 1) { Tcl_AppendResult(interp, "bad command token \"", argv[2], @@ -1608,7 +1608,7 @@ CreatedCommandProc( &info); if (!found) { Tcl_AppendResult(interp, "CreatedCommandProc could not get command info for test_ns_basic::createdcommand", - NULL); + (void *)NULL); return TCL_ERROR; } Tcl_AppendResult(interp, "CreatedCommandProc in ", @@ -2835,7 +2835,7 @@ TestexprlongCmd( " expression\"", (void *)NULL); return TCL_ERROR; } - Tcl_AppendResult(interp, "This is a result", NULL); + Tcl_AppendResult(interp, "This is a result", (void *)NULL); result = Tcl_ExprLong(interp, argv[1], &exprResult); if (result != TCL_OK) { return result; @@ -5045,23 +5045,23 @@ TestseterrorcodeCmd( } switch (argc) { case 1: - Tcl_SetErrorCode(interp, "NONE", NULL); + Tcl_SetErrorCode(interp, "NONE", (void *)NULL); break; case 2: - Tcl_SetErrorCode(interp, argv[1], NULL); + Tcl_SetErrorCode(interp, argv[1], (void *)NULL); break; case 3: - Tcl_SetErrorCode(interp, argv[1], argv[2], NULL); + Tcl_SetErrorCode(interp, argv[1], argv[2], (void *)NULL); break; case 4: - Tcl_SetErrorCode(interp, argv[1], argv[2], argv[3], NULL); + Tcl_SetErrorCode(interp, argv[1], argv[2], argv[3], (void *)NULL); break; case 5: - Tcl_SetErrorCode(interp, argv[1], argv[2], argv[3], argv[4], NULL); + Tcl_SetErrorCode(interp, argv[1], argv[2], argv[3], argv[4], (void *)NULL); break; case 6: Tcl_SetErrorCode(interp, argv[1], argv[2], argv[3], argv[4], - argv[5], NULL); + argv[5], (void *)NULL); } return TCL_ERROR; } @@ -6517,7 +6517,7 @@ TestChannelCmd( } Tcl_AppendResult(interp, - (statePtr->flags & INPUT_SAW_CR) ? "1" : "0", NULL); + (statePtr->flags & INPUT_SAW_CR) ? "1" : "0", (void *)NULL); return TCL_OK; } @@ -6607,7 +6607,7 @@ TestChannelCmd( } if (strcmp(argv[3], "-command") != 0) { Tcl_AppendResult(interp, "bad argument \"", argv[3], - "\": should be \"-command\"", NULL); + "\": should be \"-command\"", (void *)NULL); return TCL_ERROR; } @@ -8291,7 +8291,7 @@ TestconcatobjCmd( Tcl_DecrRefCount(tmpPtr); break; default: - Tcl_AppendResult(interp, "(more than one refCount added!)", NULL); + Tcl_AppendResult(interp, "(more than one refCount added!)", (void *)NULL); Tcl_Panic("extremely unsafe behaviour by Tcl_ConcatObj()"); } tmpPtr = Tcl_DuplicateObj(list1Ptr); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index b4d70f0..3b958dd 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -420,7 +420,7 @@ TestbooleanobjCmd( } else { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option \"", Tcl_GetString(objv[1]), - "\": must be set, get, or not", NULL); + "\": must be set, get, or not", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -537,7 +537,7 @@ TestdoubleobjCmd( } else { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option \"", Tcl_GetString(objv[1]), - "\": must be set, get, mult10, or div10", NULL); + "\": must be set, get, mult10, or div10", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -826,7 +826,7 @@ TestintobjCmd( } else { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option \"", Tcl_GetString(objv[1]), - "\": must be set, get, get2, mult10, or div10", NULL); + "\": must be set, get, get2, mult10, or div10", (void *)NULL); return TCL_ERROR; } return TCL_OK; @@ -1199,7 +1199,7 @@ TestobjCmd( } if ((targetType = Tcl_GetObjType(Tcl_GetString(objv[3]))) == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "no type ", Tcl_GetString(objv[3]), " found", NULL); + "no type ", Tcl_GetString(objv[3]), " found", (void *)NULL); return TCL_ERROR; } if (Tcl_ConvertToType(interp, varPtr[varIndex], targetType) @@ -1356,7 +1356,7 @@ TeststringobjCmd( Tcl_AppendStringsToObj(varPtr[varIndex], strings[0], strings[1], strings[2], strings[3], strings[4], strings[5], strings[6], strings[7], strings[8], strings[9], - strings[10], strings[11]); + strings[10], strings[11], (void *)NULL); Tcl_SetObjResult(interp, varPtr[varIndex]); break; case 2: /* get */ diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 07800ca..2139b81 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -263,7 +263,7 @@ ProcBodyTestProcObjCmd( if (cmdPtr->objClientData != TclIsProc(cmdPtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "command \"", fullName, "\" is not a Tcl procedure", NULL); + "command \"", fullName, "\" is not a Tcl procedure", (void *)NULL); return TCL_ERROR; } @@ -274,7 +274,7 @@ ProcBodyTestProcObjCmd( procPtr = (Proc *) cmdPtr->objClientData; if (procPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "procedure \"", - fullName, "\" does not have a Proc struct!", NULL); + fullName, "\" does not have a Proc struct!", (void *)NULL); return TCL_ERROR; } @@ -286,7 +286,7 @@ ProcBodyTestProcObjCmd( if (bodyObjPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "failed to create a procbody object for procedure \"", - fullName, "\"", NULL); + fullName, "\"", (void *)NULL); return TCL_ERROR; } Tcl_IncrRefCount(bodyObjPtr); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 7b158b4..cd74071 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -913,7 +913,7 @@ ThreadSend( if (resultPtr->code != TCL_OK) { if (resultPtr->errorCode) { - Tcl_SetErrorCode(interp, resultPtr->errorCode, NULL); + Tcl_SetErrorCode(interp, resultPtr->errorCode, (void *)NULL); ckfree(resultPtr->errorCode); } if (resultPtr->errorInfo) { diff --git a/win/tclWinDde.c b/win/tclWinDde.c index d01e7ae..7db5312 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -574,7 +574,7 @@ ExecuteRemoteObject( Tcl_SetObjResult(riPtr->interp, Tcl_NewStringObj("permission denied: " "a handler procedure must be defined for use in a safe " "interp", TCL_INDEX_NONE)); - Tcl_SetErrorCode(riPtr->interp, "TCL", "DDE", "SECURITY_CHECK", NULL); + Tcl_SetErrorCode(riPtr->interp, "TCL", "DDE", "SECURITY_CHECK", (void *)NULL); result = TCL_ERROR; } @@ -1046,7 +1046,7 @@ MakeDdeConnection( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no registered server named \"%s\"", Tcl_DStringValue(&dString))); Tcl_DStringFree(&dString); - Tcl_SetErrorCode(interp, "TCL", "DDE", "NO_SERVER", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "NO_SERVER", (void *)NULL); } return TCL_ERROR; } @@ -1277,7 +1277,7 @@ SetDdeError( } Tcl_SetObjResult(interp, Tcl_NewStringObj(errorMessage, TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TCL", "DDE", errorCode, NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", errorCode, (void *)NULL); } /* @@ -1564,7 +1564,7 @@ DdeObjCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot execute null data", TCL_INDEX_NONE)); Tcl_DStringFree(&dsBuf); - Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", (void *)NULL); result = TCL_ERROR; break; } @@ -1614,7 +1614,7 @@ DdeObjCmd( if (length == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot request value of null data", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", (void *)NULL); result = TCL_ERROR; goto cleanup; } @@ -1680,7 +1680,7 @@ DdeObjCmd( if (length == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot have a null item", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "NULL", (void *)NULL); result = TCL_ERROR; goto cleanup; } @@ -1734,7 +1734,7 @@ DdeObjCmd( if (serviceName == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid service name \"\"", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TCL", "DDE", "NO_SERVER", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "NO_SERVER", (void *)NULL); result = TCL_ERROR; goto cleanup; } @@ -1783,7 +1783,7 @@ DdeObjCmd( "permission denied: a handler procedure must be" " defined for use in a safe interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TCL", "DDE", "SECURITY_CHECK", - NULL); + (void *)NULL); result = TCL_ERROR; } @@ -1848,7 +1848,7 @@ DdeObjCmd( invalidServerResponse: Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid data returned from server", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TCL", "DDE", "BAD_RESPONSE", NULL); + Tcl_SetErrorCode(interp, "TCL", "DDE", "BAD_RESPONSE", (void *)NULL); result = TCL_ERROR; goto cleanup; } diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 1ccb105..4157380 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -462,7 +462,7 @@ DeleteKey( if (*keyName == '\0') { Tcl_SetObjResult(interp, Tcl_NewStringObj("bad key: cannot delete root keys", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "WIN_REG", "DEL_ROOT_KEY", NULL); + Tcl_SetErrorCode(interp, "WIN_REG", "DEL_ROOT_KEY", (void *)NULL); Tcl_Free(buffer); return TCL_ERROR; } @@ -1143,7 +1143,7 @@ ParseKeyName( if (!rootName) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad key \"%s\": must start with a valid root", name)); - Tcl_SetErrorCode(interp, "WIN_REG", "NO_ROOT_KEY", NULL); + Tcl_SetErrorCode(interp, "WIN_REG", "NO_ROOT_KEY", (void *)NULL); return TCL_ERROR; } @@ -1535,7 +1535,7 @@ AppendSystemError( } snprintf(id, sizeof(id), "%ld", error); - Tcl_SetErrorCode(interp, "WINDOWS", id, msg, NULL); + Tcl_SetErrorCode(interp, "WINDOWS", id, msg, (void *)NULL); Tcl_AppendToObj(resultPtr, msg, length); Tcl_SetObjResult(interp, resultPtr); -- cgit v0.12 From 07279ebb64ef3359cd341e8ef7f8f99ea36dedd1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 29 Oct 2023 21:45:31 +0000 Subject: Fix [0219fb7511]: tclIO.c: avoid -Wstrict-prototypes warning. Some code cleanup --- generic/tclIO.c | 120 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 7e83e89..0f79f1e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -103,7 +103,7 @@ typedef struct CopyState { Tcl_Interp *interp; /* Interp that started the copy. */ Tcl_Obj *cmdPtr; /* Command to be invoked at completion. */ int bufSize; /* Size of appended buffer. */ - char buffer[1]; /* Copy buffer, this must be the last + char buffer[TCLFLEXARRAY]; /* Copy buffer, this must be the last * field. */ } CopyState; @@ -557,7 +557,6 @@ TclInitIOSubsystem(void) *------------------------------------------------------------------------- */ - /* ARGSUSED */ void TclFinalizeIOSubsystem(void) { @@ -1444,7 +1443,7 @@ Tcl_GetChannel( if (hPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can not find channel named \"%s\"", chanName)); - Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CHANNEL", chanName, NULL); + Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CHANNEL", chanName, (void *)NULL); return NULL; } @@ -1457,7 +1456,7 @@ Tcl_GetChannel( chanPtr = (Channel *)Tcl_GetHashValue(hPtr); chanPtr = chanPtr->state->bottomChanPtr; if (modePtr != NULL) { - *modePtr = chanPtr->state->flags & (TCL_READABLE|TCL_WRITABLE); + *modePtr = GotFlag(chanPtr->state, TCL_READABLE|TCL_WRITABLE); } return (Tcl_Channel) chanPtr; @@ -1553,7 +1552,7 @@ TclGetChannelFromObj( *channelPtr = (Tcl_Channel) statePtr->bottomChanPtr; if (modePtr != NULL) { - *modePtr = statePtr->flags & (TCL_READABLE|TCL_WRITABLE); + *modePtr = GotFlag(statePtr, TCL_READABLE|TCL_WRITABLE); } return TCL_OK; @@ -1847,7 +1846,7 @@ Tcl_StackChannel( * --+---+---+---+----+ */ - if ((mask & (statePtr->flags & (TCL_READABLE | TCL_WRITABLE))) == 0) { + if ((mask & GotFlag(statePtr, TCL_READABLE|TCL_WRITABLE)) == 0) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "reading and writing both disallowed for channel \"%s\"", @@ -2345,7 +2344,7 @@ Tcl_GetChannelMode( ChannelState *statePtr = ((Channel *) chan)->state; /* State of actual channel. */ - return (statePtr->flags & (TCL_READABLE | TCL_WRITABLE)); + return GotFlag(statePtr, TCL_READABLE|TCL_WRITABLE); } /* @@ -2529,7 +2528,7 @@ RecycleBuffer( * This is to honor dynamic changes of the buffe rsize made by the user. */ - if ((bufPtr->bufLength - BUFFER_PADDING) != statePtr->bufSize) { + if ((bufPtr->bufLength) != statePtr->bufSize + BUFFER_PADDING) { ReleaseChannelBuffer(bufPtr); return; } @@ -2850,8 +2849,8 @@ FlushChannel( * queued. */ - DiscardOutputQueued(statePtr); ReleaseChannelBuffer(bufPtr); + DiscardOutputQueued(statePtr); break; } else { /* @@ -3360,7 +3359,6 @@ Tcl_SpliceChannel( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_Close( Tcl_Interp *interp, /* Interpreter for errors. */ @@ -3554,7 +3552,6 @@ Tcl_Close( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_CloseEx( Tcl_Interp *interp, /* Interpreter for errors. */ @@ -3609,7 +3606,7 @@ Tcl_CloseEx( * opened for that direction). */ - if (!(statePtr->flags & (TCL_READABLE | TCL_WRITABLE) & flags)) { + if (!(GotFlag(statePtr, TCL_READABLE|TCL_WRITABLE) & flags)) { const char *msg; if (flags & TCL_CLOSE_READ) { @@ -3628,7 +3625,7 @@ Tcl_CloseEx( * That won't do. */ - if (statePtr->flags & CHANNEL_INCLOSE) { + if (GotFlag(statePtr, CHANNEL_INCLOSE)) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "illegal recursive call to close through close-handler" @@ -4065,7 +4062,8 @@ Tcl_WriteRaw( Channel *chanPtr = ((Channel *) chan); ChannelState *statePtr = chanPtr->state; /* State info for channel */ - int errorCode, written; + int errorCode; + int written; if (CheckChannelErrors(statePtr, TCL_WRITABLE | CHANNEL_RAW_MODE) != 0) { return -1; @@ -4282,13 +4280,14 @@ static int Write( Channel *chanPtr, /* The channel to buffer output for. */ const char *src, /* UTF-8 string to write. */ - int srcLen, /* Length of UTF-8 string in bytes. */ + int srcLen, /* Length of UTF-8 string in bytes. */ Tcl_Encoding encoding) { ChannelState *statePtr = chanPtr->state; /* State info for channel */ char *nextNewLine = NULL; - int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0; + int endEncoding, needNlFlush = 0; + int saved = 0, total = 0, flushed = 0; char safe[BUFFER_PADDING]; int encodingError = 0; @@ -4301,7 +4300,6 @@ Write( */ endEncoding = ((statePtr->outputEncodingFlags & TCL_ENCODING_END) != 0); - if (GotFlag(statePtr, CHANNEL_LINEBUFFERED) || (statePtr->outputTranslation != TCL_TRANSLATE_LF)) { nextNewLine = (char *)memchr(src, '\n', srcLen); @@ -4310,7 +4308,8 @@ Write( while (srcLen + saved + endEncoding > 0 && !encodingError) { ChannelBuffer *bufPtr; char *dst; - int result, srcRead, dstLen, dstWrote, srcLimit = srcLen; + int result, srcRead, dstLen, dstWrote; + int srcLimit = srcLen; if (nextNewLine) { srcLimit = nextNewLine - src; @@ -4527,7 +4526,8 @@ Tcl_GetsObj( ChannelState *statePtr = chanPtr->state; /* State info for channel */ ChannelBuffer *bufPtr; - int inEofChar, skip, copiedTotal, oldLength, oldFlags, oldRemoved; + int inEofChar, skip, copiedTotal, oldFlags, oldRemoved; + int oldLength; Tcl_Encoding encoding; char *dst, *dstEnd, *eol, *eof; Tcl_EncodingState oldState; @@ -5208,7 +5208,7 @@ FreeBinaryEncoding( } static Tcl_Encoding -GetBinaryEncoding() +GetBinaryEncoding(void) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -5352,6 +5352,7 @@ FilterInputBytes( *gsPtr->dstPtr = dst; } gsPtr->state = statePtr->inputEncodingState; + result = Tcl_ExternalToUtf(NULL, gsPtr->encoding, raw, rawLen, statePtr->inputEncodingFlags | TCL_ENCODING_NO_TERMINATE, &statePtr->inputEncodingState, dst, spaceLeft, &gsPtr->rawRead, @@ -5752,7 +5753,7 @@ int Tcl_ReadChars( Tcl_Channel chan, /* The channel to read. */ Tcl_Obj *objPtr, /* Input data is stored in this object. */ - int toRead, /* Maximum number of characters to store, or + int toRead, /* Maximum number of characters to store, or * -1 to read all available data (up to EOF or * when channel blocks). */ int appendFlag) /* If non-zero, data read from the channel @@ -5808,7 +5809,7 @@ static int DoReadChars( Channel *chanPtr, /* The channel to read. */ Tcl_Obj *objPtr, /* Input data is stored in this object. */ - int toRead, /* Maximum number of characters to store, or + int toRead, /* Maximum number of characters to store, or * -1 to read all available data (up to EOF or * when channel blocks). */ int appendFlag) /* If non-zero, data read from the channel @@ -5819,7 +5820,8 @@ DoReadChars( ChannelState *statePtr = chanPtr->state; /* State info for channel */ ChannelBuffer *bufPtr; - int copied, copiedNow, result; + int copied; + int result; Tcl_Encoding encoding = statePtr->encoding; int binaryMode; #define UTF_EXPANSION_FACTOR 1024 @@ -5859,7 +5861,7 @@ DoReadChars( assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); - /* TODO: We don't need this call? */ + /* TODO: UpdateInterest not needed here? */ UpdateInterest(chanPtr); return 0; } @@ -5873,7 +5875,7 @@ DoReadChars( } ResetFlag(statePtr, CHANNEL_BLOCKED|CHANNEL_EOF); statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; - /* TODO: We don't need this call? */ + /* TODO: UpdateInterest not needed here? */ UpdateInterest(chanPtr); return 0; } @@ -5895,7 +5897,7 @@ DoReadChars( ResetFlag(statePtr, CHANNEL_BLOCKED|CHANNEL_EOF); statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; for (copied = 0; (unsigned) toRead > 0; ) { - copiedNow = -1; + int copiedNow = -1; if (statePtr->inQueueHead != NULL) { if (binaryMode) { copiedNow = ReadBytes(statePtr, objPtr, toRead); @@ -5904,7 +5906,7 @@ DoReadChars( } /* - * If the current buffer is empty recycle it. + * Recycle current buffer if empty. */ bufPtr = statePtr->inQueueHead; @@ -5956,7 +5958,7 @@ DoReadChars( } /* - * Regenerate the top channel, in case it was changed due to + * Regenerate chanPtr in case it was changed due to * self-modifying reflected transforms. */ @@ -6300,7 +6302,7 @@ ReadChars( return 1; } - } else if (statePtr->flags & CHANNEL_EOF) { + } else if (GotFlag(statePtr, CHANNEL_EOF)) { /* * The bare \r is the only char and we will never read a * subsequent char to make the determination. @@ -6403,7 +6405,7 @@ ReadChars( * precautions. */ - if (nextPtr->nextRemoved - srcLen < 0) { + if (nextPtr->nextRemoved < srcLen) { Tcl_Panic("Buffer Underflow, BUFFER_PADDING not enough"); } @@ -6566,7 +6568,7 @@ TranslateInputEOL( char *dst = dstStart; int lesser; - if ((statePtr->flags & INPUT_SAW_CR) && srcLen) { + if (GotFlag(statePtr, INPUT_SAW_CR) && srcLen) { if (*src == '\n') { src++; srcLen--; } ResetFlag(statePtr, INPUT_SAW_CR); } @@ -6900,7 +6902,7 @@ GetInput( */ if ((bufPtr != NULL) - && (bufPtr->bufLength - BUFFER_PADDING != statePtr->bufSize)) { + && (bufPtr->bufLength != statePtr->bufSize + BUFFER_PADDING)) { ReleaseChannelBuffer(bufPtr); bufPtr = NULL; } @@ -7370,7 +7372,7 @@ CheckChannelErrors( * Fail if the channel is not opened for desired operation. */ - if ((statePtr->flags & direction) == 0) { + if (GotFlag(statePtr, direction) == 0) { Tcl_SetErrno(EACCES); return -1; } @@ -7480,7 +7482,7 @@ Tcl_InputBuffered( } /* - * Don't forget the bytes in the topmost pushback area. + * Remember the bytes in the topmost pushback area. */ for (bufPtr = statePtr->topChanPtr->inQueueHead; bufPtr != NULL; @@ -8690,7 +8692,7 @@ Tcl_CreateChannelHandler( /* * The remainder of the initialization below is done regardless of whether - * or not this is a new record or a modification of an old one. + * this is a new record or a modification of an old one. */ chPtr->mask = mask; @@ -9004,7 +9006,6 @@ TclChannelEventScriptInvoker( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FileEventObjCmd( ClientData dummy, /* Not used. */ @@ -9040,7 +9041,7 @@ Tcl_FileEventObjCmd( } chanPtr = (Channel *) chan; statePtr = chanPtr->state; - if ((statePtr->flags & mask) == 0) { + if (GotFlag(statePtr, mask) == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("channel is not %s", (mask == TCL_READABLE) ? "readable" : "writable")); return TCL_ERROR; @@ -9225,7 +9226,7 @@ TclCopyChannel( * completed. */ - csPtr = (CopyState *)ckalloc(sizeof(CopyState) + !moveBytes * inStatePtr->bufSize); + csPtr = (CopyState *)ckalloc(offsetof(CopyState, buffer) + 1U + !moveBytes * inStatePtr->bufSize); csPtr->bufSize = !moveBytes * inStatePtr->bufSize; csPtr->readPtr = inPtr; csPtr->writePtr = outPtr; @@ -9415,13 +9416,13 @@ MBWrite( if (bufPtr) { /* Split the overflowing buffer in two */ int extra = (int) (inBytes - csPtr->toRead); - /* Note that going with int for extra assumes that inBytes is not too - * much over toRead to require a wide itself. If that gets violated - * then the calculations involving extra must be made wide too. - * - * Noted with Win32/MSVC debug build treating the warning (possible of - * data in __int64 to int conversion) as error. - */ + /* Note that going with int for extra assumes that inBytes is not too + * much over toRead to require a wide itself. If that gets violated + * then the calculations involving extra must be made wide too. + * + * Noted with Win32/MSVC debug build treating the warning (possible of + * data in __int64 to int conversion) as error. + */ bufPtr = AllocChannelBuffer(extra); @@ -9519,8 +9520,10 @@ CopyData( Tcl_Obj *cmdPtr, *errObj = NULL, *bufObj = NULL, *msg = NULL; Tcl_Channel inChan, outChan; ChannelState *inStatePtr, *outStatePtr; - int result = TCL_OK, size, sizeb; + int result = TCL_OK; + int sizeb; Tcl_WideInt total; + int size; const char *buffer; int inBinary, outBinary, sameEncoding; /* Encoding control */ @@ -9603,12 +9606,12 @@ CopyData( if (interp) { TclNewObj(errObj); Tcl_AppendStringsToObj(errObj, "error reading \"", - Tcl_GetChannelName(inChan), "\": ", NULL); + Tcl_GetChannelName(inChan), "\": ", (void *)NULL); if (msg != NULL) { Tcl_AppendObjToObj(errObj, msg); } else { Tcl_AppendStringsToObj(errObj, Tcl_PosixError(interp), - NULL); + (void *)NULL); } } if (msg != NULL) { @@ -9684,12 +9687,12 @@ CopyData( if (interp) { TclNewObj(errObj); Tcl_AppendStringsToObj(errObj, "error writing \"", - Tcl_GetChannelName(outChan), "\": ", NULL); + Tcl_GetChannelName(outChan), "\": ", (void *)NULL); if (msg != NULL) { Tcl_AppendObjToObj(errObj, msg); } else { Tcl_AppendStringsToObj(errObj, Tcl_PosixError(interp), - NULL); + (void *)NULL); } } if (msg != NULL) { @@ -9985,7 +9988,7 @@ DoRead( * There's no more buffered data... */ - if (statePtr->flags & CHANNEL_EOF) { + if (GotFlag(statePtr, CHANNEL_EOF)) { /* * ...and there never will be. */ @@ -9993,7 +9996,7 @@ DoRead( *p++ = '\r'; bytesToRead--; bufPtr->nextRemoved++; - } else if (statePtr->flags & CHANNEL_BLOCKED) { + } else if (GotFlag(statePtr, CHANNEL_BLOCKED)) { /* * ...and we cannot get more now. */ @@ -10126,20 +10129,20 @@ StopCopy( */ nonBlocking = csPtr->readFlags & CHANNEL_NONBLOCKING; - if (nonBlocking != (inStatePtr->flags & CHANNEL_NONBLOCKING)) { + if (nonBlocking != GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) { SetBlockMode(NULL, csPtr->readPtr, nonBlocking ? TCL_MODE_NONBLOCKING : TCL_MODE_BLOCKING); } if (csPtr->readPtr != csPtr->writePtr) { nonBlocking = csPtr->writeFlags & CHANNEL_NONBLOCKING; - if (nonBlocking != (outStatePtr->flags & CHANNEL_NONBLOCKING)) { + if (nonBlocking != GotFlag(outStatePtr, CHANNEL_NONBLOCKING)) { SetBlockMode(NULL, csPtr->writePtr, nonBlocking ? TCL_MODE_NONBLOCKING : TCL_MODE_BLOCKING); } } ResetFlag(outStatePtr, CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); - outStatePtr->flags |= - csPtr->writeFlags & (CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); + SetFlag(outStatePtr, + csPtr->writeFlags & (CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED)); if (csPtr->cmdPtr) { Tcl_DeleteChannelHandler(inChan, CopyEventProc, csPtr); @@ -11011,7 +11014,8 @@ static Tcl_Obj * FixLevelCode( Tcl_Obj *msg) { - int explicitResult, numOptions, lc, lcn; + int explicitResult, numOptions, lcn; + int lc; Tcl_Obj **lv, **lvn; int res, i, j, val, lignore, cignore; int newlevel = -1, newcode = -1; @@ -11304,8 +11308,8 @@ DumpFlags( char *str, int flags) { - char buf[20]; int i = 0; + char buf[24]; #define ChanFlag(chr, bit) (buf[i++] = ((flags & (bit)) ? (chr) : '_')) -- cgit v0.12