From 801ae4d914336ab3d9d7be983286d8843c20e4c0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Jun 2023 07:40:19 +0000 Subject: Revert 'fix' for [ac874937c5], committed as part of a "Merge 8.7" commit. It's wrong, since "embtest" is expected to be an executable, not a shared library --- unix/dltest/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/dltest/Makefile.in b/unix/dltest/Makefile.in index 418f2bd..e8dce2f 100644 --- a/unix/dltest/Makefile.in +++ b/unix/dltest/Makefile.in @@ -79,7 +79,7 @@ pkgooa.o: $(SRC_DIR)/pkgooa.c $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgooa.c embtest: embtest.o - $(SHLIB_LD) -o $@ embtest.o ${SHLIB_LD_LIBS} + $(CC) -o $@ embtest.o ${SHLIB_LD_LIBS} tcl9pkgπ${SHLIB_SUFFIX}: pkgπ.o ${SHLIB_LD} -o $@ pkgπ.o ${SHLIB_LD_LIBS} -- cgit v0.12 From 81da6c1a9a581f2c39da7407696275149874aca3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Jun 2023 13:08:30 +0000 Subject: Since TCL_MAJOR_VERSION is always "8", don't check for it. Add C++-compatible typecasts. --- generic/tcl.h | 6 +-- generic/tclCompCmds.c | 90 +++++++++++++++++---------------------- generic/tclCompCmdsGR.c | 61 ++++++++++++++------------ generic/tclCompCmdsSZ.c | 111 +++++++++++++++++++++++------------------------- generic/tclDecls.h | 16 +++---- generic/tclIOCmd.c | 26 +++++------- generic/tclListObj.c | 24 +++++------ 7 files changed, 156 insertions(+), 178 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 942ca72..3de3208 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -131,7 +131,7 @@ extern "C" { */ #include -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) # define TCL_VARARGS(type, name) (type name, ...) # define TCL_VARARGS_DEF(type, name) (type name, ...) # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) @@ -505,7 +505,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; */ typedef struct Tcl_Interp -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) { /* TIP #330: Strongly discourage extensions from using the string * result. */ @@ -1134,7 +1134,7 @@ typedef struct Tcl_DString { * give the flag) */ -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) # define TCL_PARSE_PART1 0x400 #endif /* !TCL_NO_DEPRECATED */ diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1f3674c..bafcb13 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -5,9 +5,9 @@ * commands into a sequence of instructions ("bytecodes"). * * Copyright (c) 1997-1998 Sun Microsystems, Inc. - * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2001 Kevin B. Kenny. All rights reserved. * Copyright (c) 2002 ActiveState Corporation. - * Copyright (c) 2004-2013 by Donal K. Fellows. + * Copyright (c) 2004-2013 Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -21,28 +21,16 @@ * Prototypes for procedures defined later in this file: */ -static ClientData DupDictUpdateInfo(ClientData clientData); -static void FreeDictUpdateInfo(ClientData clientData); -static void PrintDictUpdateInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleDictUpdateInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); -static ClientData DupForeachInfo(ClientData clientData); -static void FreeForeachInfo(ClientData clientData); -static void PrintForeachInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleForeachInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); -static void PrintNewForeachInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleNewForeachInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); +static AuxDataDupProc DupDictUpdateInfo; +static AuxDataFreeProc FreeDictUpdateInfo; +static AuxDataPrintProc PrintDictUpdateInfo; +static AuxDataPrintProc DisassembleDictUpdateInfo; +static AuxDataDupProc DupForeachInfo; +static AuxDataFreeProc FreeForeachInfo; +static AuxDataPrintProc PrintForeachInfo; +static AuxDataPrintProc DisassembleForeachInfo; +static AuxDataPrintProc PrintNewForeachInfo; +static AuxDataPrintProc DisassembleNewForeachInfo; static int CompileEachloopCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, CompileEnv *envPtr, int collect); @@ -403,9 +391,9 @@ TclCompileArraySetCmd( keyVar = AnonymousLocal(envPtr); valVar = AnonymousLocal(envPtr); - infoPtr = ckalloc(TclOffset(ForeachInfo, varLists) + sizeof(ForeachVarList *)); + infoPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists) + sizeof(ForeachVarList *)); infoPtr->numLists = 1; - infoPtr->varLists[0] = ckalloc(TclOffset(ForeachVarList, varIndexes) + 2 * sizeof(int)); + infoPtr->varLists[0] = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes) + 2 * sizeof(int)); infoPtr->varLists[0]->numVars = 2; infoPtr->varLists[0]->varIndexes[0] = keyVar; infoPtr->varLists[0]->varIndexes[1] = valVar; @@ -1776,9 +1764,9 @@ TclCompileDictUpdateCmd( * that are to be used. */ - duiPtr = ckalloc(TclOffset(DictUpdateInfo, varIndices) + sizeof(int) * numVars); + duiPtr = (DictUpdateInfo *)ckalloc(TclOffset(DictUpdateInfo, varIndices) + sizeof(int) * numVars); duiPtr->length = numVars; - keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars); + keyTokenPtrs = (Tcl_Token **)TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars); tokenPtr = TokenAfter(dictVarTokenPtr); for (i=0 ; ilength; - dui2Ptr = ckalloc(len); + dui2Ptr = (DictUpdateInfo *)ckalloc(len); memcpy(dui2Ptr, dui1Ptr, len); return dui2Ptr; } @@ -2278,7 +2266,7 @@ PrintDictUpdateInfo( ByteCode *codePtr, unsigned int pcOffset) { - DictUpdateInfo *duiPtr = clientData; + DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData; int i; for (i=0 ; ilength ; i++) { @@ -2296,7 +2284,7 @@ DisassembleDictUpdateInfo( ByteCode *codePtr, unsigned int pcOffset) { - DictUpdateInfo *duiPtr = clientData; + DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData; int i; Tcl_Obj *variables; @@ -2631,8 +2619,8 @@ TclCompileLmapCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to definition of command being - * compiled. */ + Command *cmdPtr, /* Points to the definition of the command + * being compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { return CompileEachloopCmd(interp, parsePtr, cmdPtr, envPtr, @@ -2694,7 +2682,7 @@ CompileEachloopCmd( } /* - * Bail out if the body requires substitutions in order to insure correct + * Bail out if the body requires substitutions in order to ensure correct * behaviour. [Bug 219166] */ @@ -2713,7 +2701,7 @@ CompileEachloopCmd( */ numLists = (numWords - 2)/2; - infoPtr = ckalloc(TclOffset(ForeachInfo, varLists) + infoPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists) + numLists * sizeof(ForeachVarList *)); infoPtr->numLists = 0; /* Count this up as we go */ @@ -2747,7 +2735,7 @@ CompileEachloopCmd( goto done; } - varListPtr = ckalloc(TclOffset(ForeachVarList, varIndexes) + varListPtr = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes) + numVars * sizeof(int)); varListPtr->numVars = numVars; infoPtr->varLists[i/2] = varListPtr; @@ -2878,12 +2866,12 @@ DupForeachInfo( ClientData clientData) /* The foreach command's compilation auxiliary * data to duplicate. */ { - ForeachInfo *srcPtr = clientData; + ForeachInfo *srcPtr = (ForeachInfo *)clientData; ForeachInfo *dupPtr; ForeachVarList *srcListPtr, *dupListPtr; int numVars, i, j, numLists = srcPtr->numLists; - dupPtr = ckalloc(TclOffset(ForeachInfo, varLists) + dupPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists) + numLists * sizeof(ForeachVarList *)); dupPtr->numLists = numLists; dupPtr->firstValueTemp = srcPtr->firstValueTemp; @@ -2892,7 +2880,7 @@ DupForeachInfo( for (i = 0; i < numLists; i++) { srcListPtr = srcPtr->varLists[i]; numVars = srcListPtr->numVars; - dupListPtr = ckalloc(TclOffset(ForeachVarList, varIndexes) + dupListPtr = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes) + numVars * sizeof(int)); dupListPtr->numVars = numVars; for (j = 0; j < numVars; j++) { @@ -2927,7 +2915,7 @@ FreeForeachInfo( ClientData clientData) /* The foreach command's compilation auxiliary * data to free. */ { - ForeachInfo *infoPtr = clientData; + ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *listPtr; int numLists = infoPtr->numLists; int i; @@ -2963,7 +2951,7 @@ PrintForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - ForeachInfo *infoPtr = clientData; + ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; @@ -3003,7 +2991,7 @@ PrintNewForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - ForeachInfo *infoPtr = clientData; + ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; @@ -3033,7 +3021,7 @@ DisassembleForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - ForeachInfo *infoPtr = clientData; + ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; @@ -3080,7 +3068,7 @@ DisassembleNewForeachInfo( ByteCode *codePtr, unsigned int pcOffset) { - ForeachInfo *infoPtr = clientData; + ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; @@ -3140,7 +3128,7 @@ TclCompileFormatCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; Tcl_Obj **objv, *formatObj, *tmpObj; - char *bytes, *start; + const char *bytes, *start; int i, j, len; /* @@ -3164,7 +3152,7 @@ TclCompileFormatCmd( return TCL_ERROR; } - objv = ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *)); for (i=0 ; i+2 < parsePtr->numWords ; i++) { tokenPtr = TokenAfter(tokenPtr); TclNewObj(objv[i]); @@ -3267,7 +3255,7 @@ TclCompileFormatCmd( if (*++bytes == '%') { Tcl_AppendToObj(tmpObj, "%", 1); } else { - char *b = Tcl_GetStringFromObj(tmpObj, &len); + const char *b = Tcl_GetStringFromObj(tmpObj, &len); /* * If there is a non-empty literal from the format string, @@ -3458,7 +3446,7 @@ TclPushVarName( * assemble the corresponding token. */ - elemTokenPtr = TclStackAlloc(interp, sizeof(Tcl_Token)); + elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, sizeof(Tcl_Token)); allocedTokens = 1; elemTokenPtr->type = TCL_TOKEN_TEXT; elemTokenPtr->start = elName; @@ -3512,7 +3500,7 @@ TclPushVarName( * token. */ - elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token)); + elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, n * sizeof(Tcl_Token)); allocedTokens = 1; elemTokenPtr->type = TCL_TOKEN_TEXT; elemTokenPtr->start = elName; diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 3592663..7efe6ae 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -6,9 +6,9 @@ * of instructions ("bytecodes"). * * Copyright (c) 1997-1998 Sun Microsystems, Inc. - * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2001 Kevin B. Kenny. All rights reserved. * Copyright (c) 2002 ActiveState Corporation. - * Copyright (c) 2004-2013 by Donal K. Fellows. + * Copyright (c) 2004-2013 Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -27,7 +27,6 @@ static void CompileReturnInternal(CompileEnv *envPtr, Tcl_Obj *returnOpts); static int IndexTailVarIfKnown(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr); - /* *---------------------------------------------------------------------- @@ -128,9 +127,12 @@ TclCompileGlobalCmd( return TCL_ERROR; } - /* TODO: Consider what value can pass through the - * IndexTailVarIfKnown() screen. Full CompileWord() - * likely does not apply here. Push known value instead. */ + /* + * TODO: Consider what value can pass through the + * IndexTailVarIfKnown() screen. Full CompileWord() likely does not + * apply here. Push known value instead. + */ + CompileWord(envPtr, varTokenPtr, interp, i); TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); } @@ -181,7 +183,8 @@ TclCompileIfCmd( * determined. */ Tcl_Token *tokenPtr, *testTokenPtr; int jumpIndex = 0; /* Avoid compiler warning. */ - int jumpFalseDist, numWords, wordIdx, numBytes, j, code; + int numBytes, j; + int jumpFalseDist, numWords, wordIdx, code; const char *word; int realCond = 1; /* Set to 0 for static conditions: * "if 0 {..}" */ @@ -271,7 +274,7 @@ TclCompileIfCmd( jumpIndex = jumpFalseFixupArray.next; jumpFalseFixupArray.next++; TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, - jumpFalseFixupArray.fixup+jumpIndex); + jumpFalseFixupArray.fixup + jumpIndex); } code = TCL_OK; } @@ -318,7 +321,7 @@ TclCompileIfCmd( } jumpEndFixupArray.next++; TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, - jumpEndFixupArray.fixup+jumpIndex); + jumpEndFixupArray.fixup + jumpIndex); /* * Fix the target of the jumpFalse after the test. Generate a 4 @@ -330,7 +333,7 @@ TclCompileIfCmd( TclAdjustStackDepth(-1, envPtr); if (TclFixupForwardJumpToHere(envPtr, - jumpFalseFixupArray.fixup+jumpIndex, 120)) { + jumpFalseFixupArray.fixup + jumpIndex, 120)) { /* * Adjust the code offset for the proceeding jump to the end * of the "if" command. @@ -588,7 +591,7 @@ TclCompileInfoCommandsCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; Tcl_Obj *objPtr; - char *bytes; + const char *bytes; /* * We require one compile-time known argument for the case we can compile. @@ -921,7 +924,7 @@ TclCompileLappendCmd( CompileWord(envPtr, valueTokenPtr, interp, i); valueTokenPtr = TokenAfter(valueTokenPtr); } - TclEmitInstInt4( INST_LIST, numWords-2, envPtr); + TclEmitInstInt4( INST_LIST, numWords - 2, envPtr); if (isScalar) { if (localIndex < 0) { TclEmitOpcode( INST_LAPPEND_LIST_STK, envPtr); @@ -998,7 +1001,7 @@ TclCompileLassignCmd( */ PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, - &isScalar, idx+2); + &isScalar, idx + 2); /* * Emit instructions to get the idx'th item out of the list value on @@ -2080,7 +2083,8 @@ TclCompileRegexpCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the * parse of the RE or string. */ - int i, len, nocase, exact, sawLast, simple; + int len; + int i, nocase, exact, sawLast, simple; const char *str; /* @@ -2184,7 +2188,7 @@ TclCompileRegexpCmd( } if (!simple) { - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-2); + CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 2); } /* @@ -2192,7 +2196,7 @@ TclCompileRegexpCmd( */ varTokenPtr = TokenAfter(varTokenPtr); - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-1); + CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 1); if (simple) { if (exact && !nocase) { @@ -2267,7 +2271,8 @@ TclCompileRegsubCmd( Tcl_Obj *patternObj = NULL, *replacementObj = NULL; Tcl_DString pattern; const char *bytes; - int len, exact, quantified, result = TCL_ERROR; + int exact, quantified, result = TCL_ERROR; + int len; if (parsePtr->numWords < 5 || parsePtr->numWords > 6) { return TCL_ERROR; @@ -2376,7 +2381,7 @@ TclCompileRegsubCmd( PushLiteral(envPtr, bytes, len); bytes = Tcl_GetStringFromObj(replacementObj, &len); PushLiteral(envPtr, bytes, len); - CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords-2); + CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords - 2); TclEmitOpcode( INST_STR_MAP, envPtr); done: @@ -2422,7 +2427,8 @@ TclCompileReturnCmd( * General syntax: [return ?-option value ...? ?result?] * An even number of words means an explicit result argument is present. */ - int level, code, objc, size, status = TCL_OK; + int level, code, objc, status = TCL_OK; + int size; int numWords = parsePtr->numWords; int explicitResult = (0 == (numWords % 2)); int numOptionWords = numWords - 1 - explicitResult; @@ -2454,7 +2460,7 @@ TclCompileReturnCmd( * Allocate some working space. */ - objv = TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *)); /* * Scan through the return options. If any are unknown at compile time, @@ -2505,7 +2511,7 @@ TclCompileReturnCmd( */ if (explicitResult) { - CompileWord(envPtr, wordTokenPtr, interp, numWords-1); + CompileWord(envPtr, wordTokenPtr, interp, numWords - 1); } else { /* * No explict result argument, so default result is empty string. @@ -2583,7 +2589,7 @@ TclCompileReturnCmd( */ if (explicitResult) { - CompileWord(envPtr, wordTokenPtr, interp, numWords-1); + CompileWord(envPtr, wordTokenPtr, interp, numWords - 1); } else { PushStringLiteral(envPtr, ""); } @@ -2814,12 +2820,12 @@ TclCompileVariableCmd( CompileWord(envPtr, varTokenPtr, interp, i); TclEmitInstInt4( INST_VARIABLE, localIndex, envPtr); - if (i+1 < numWords) { + if (i + 1 < numWords) { /* * A value has been given: set the variable, pop the value */ - CompileWord(envPtr, valueTokenPtr, interp, i+1); + CompileWord(envPtr, valueTokenPtr, interp, i + 1); Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); TclEmitOpcode( INST_POP, envPtr); } @@ -2860,7 +2866,8 @@ IndexTailVarIfKnown( { Tcl_Obj *tailPtr; const char *tailName, *p; - int len, n = varTokenPtr->numComponents; + int n = varTokenPtr->numComponents; + int len; Tcl_Token *lastTokenPtr; int full, localIndex; @@ -2895,7 +2902,7 @@ IndexTailVarIfKnown( tailName = TclGetStringFromObj(tailPtr, &len); if (len) { - if (*(tailName+len-1) == ')') { + if (*(tailName + len - 1) == ')') { /* * Possible array: bail out */ @@ -2909,7 +2916,7 @@ IndexTailVarIfKnown( */ for (p = tailName + len -1; p > tailName; p--) { - if ((*p == ':') && (*(p-1) == ':')) { + if ((*p == ':') && (*(p - 1) == ':')) { p++; break; } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 355c741..a7db705 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -7,9 +7,9 @@ * Also includes the operator command compilers. * * Copyright (c) 1997-1998 Sun Microsystems, Inc. - * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2001 Kevin B. Kenny. All rights reserved. * Copyright (c) 2002 ActiveState Corporation. - * Copyright (c) 2004-2010 by Donal K. Fellows. + * Copyright (c) 2004-2010 Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -23,14 +23,10 @@ * Prototypes for procedures defined later in this file: */ -static ClientData DupJumptableInfo(ClientData clientData); -static void FreeJumptableInfo(ClientData clientData); -static void PrintJumptableInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleJumptableInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); +static AuxDataDupProc DupJumptableInfo; +static AuxDataFreeProc FreeJumptableInfo; +static AuxDataPrintProc PrintJumptableInfo; +static AuxDataPrintProc DisassembleJumptableInfo; static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, const char *identity, int instruction, CompileEnv *envPtr); @@ -45,13 +41,12 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp, CompileEnv *envPtr); static void IssueSwitchChainedTests(Tcl_Interp *interp, CompileEnv *envPtr, int mode, int noCase, - int valueIndex, int numWords, - Tcl_Token **bodyToken, int *bodyLines, - int **bodyNext); + int numWords, Tcl_Token **bodyToken, + int *bodyLines, int **bodyNext); static void IssueSwitchJumpTable(Tcl_Interp *interp, - CompileEnv *envPtr, int valueIndex, - int numWords, Tcl_Token **bodyToken, - int *bodyLines, int **bodyContLines); + CompileEnv *envPtr, int numWords, + Tcl_Token **bodyToken, int *bodyLines, + int **bodyContLines); static int IssueTryClausesInstructions(Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, int numHandlers, int *matchCodes, @@ -467,7 +462,7 @@ TclCompileStringIsCmd( "true", "upper", "wideinteger", "wordchar", "xdigit", NULL }; - enum isClasses { + enum isClassesEnum { STR_IS_ALNUM, STR_IS_ALPHA, STR_IS_ASCII, STR_IS_CONTROL, STR_IS_BOOL, STR_IS_DIGIT, STR_IS_DOUBLE, STR_IS_ENTIER, STR_IS_FALSE, STR_IS_GRAPH, STR_IS_INT, STR_IS_LIST, @@ -531,7 +526,7 @@ TclCompileStringIsCmd( CompileWord(envPtr, tokenPtr, interp, parsePtr->numWords-1); - switch ((enum isClasses) t) { + switch ((enum isClassesEnum) t) { case STR_IS_ALNUM: strClassType = STR_CLASS_ALNUM; goto compileStrClass; @@ -692,14 +687,14 @@ TclCompileStringIsCmd( } switch (t) { - case STR_IS_INT: - PUSH( "1"); - OP( EQ); - break; case STR_IS_WIDE: PUSH( "2"); OP( LE); break; + case STR_IS_INT: + PUSH( "1"); + OP( EQ); + break; case STR_IS_ENTIER: PUSH( "3"); OP( LE); @@ -860,7 +855,7 @@ TclCompileStringMapCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *mapTokenPtr, *stringTokenPtr; Tcl_Obj *mapObj, **objv; - char *bytes; + const char *bytes; int len; /* @@ -1354,7 +1349,7 @@ static int UniCharIsHexDigit( int character) { - return (character >= 0) && (character < 0x80) && isxdigit(character); + return (character >= 0) && (character < 0x80) && isxdigit(UCHAR(character)); } StringClassDesc const tclStringClassTable[] = { @@ -1415,7 +1410,7 @@ TclCompileSubstCmd( return TCL_ERROR; } - objv = TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *)); for (objc = 0; objc < /*numArgs*/ numOpts; objc++) { TclNewObj(objv[objc]); @@ -1908,10 +1903,10 @@ TclCompileSwitchCmd( if (maxLen < 2) { return TCL_ERROR; } - bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen); - bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen); - bodyLines = ckalloc(sizeof(int) * maxLen); - bodyContLines = ckalloc(sizeof(int*) * maxLen); + bodyTokenArray = (Tcl_Token *)ckalloc(sizeof(Tcl_Token) * maxLen); + bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * maxLen); + bodyLines = (int *)ckalloc(sizeof(int) * maxLen); + bodyContLines = (int **)ckalloc(sizeof(int*) * maxLen); bline = mapPtr->loc[eclIndex].line[valueIndex+1]; numWords = 0; @@ -1970,9 +1965,9 @@ TclCompileSwitchCmd( * Multi-word definition of patterns & actions. */ - bodyToken = ckalloc(sizeof(Tcl_Token *) * numWords); - bodyLines = ckalloc(sizeof(int) * numWords); - bodyContLines = ckalloc(sizeof(int*) * numWords); + bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * numWords); + bodyLines = (int *)ckalloc(sizeof(int) * numWords); + bodyContLines = (int **)ckalloc(sizeof(int*) * numWords); bodyTokenArray = NULL; for (i=0 ; ihashTable, TCL_STRING_KEYS); infoIndex = TclCreateAuxData(jtPtr, &tclJumptableInfoType, envPtr); - finalFixups = TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2)); + finalFixups = (int *)TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2)); foundDefault = 0; mustGenerate = 1; @@ -2507,8 +2500,8 @@ static ClientData DupJumptableInfo( ClientData clientData) { - JumptableInfo *jtPtr = clientData; - JumptableInfo *newJtPtr = ckalloc(sizeof(JumptableInfo)); + JumptableInfo *jtPtr = (JumptableInfo *)clientData; + JumptableInfo *newJtPtr = (JumptableInfo *)ckalloc(sizeof(JumptableInfo)); Tcl_HashEntry *hPtr, *newHPtr; Tcl_HashSearch search; int isNew; @@ -2527,7 +2520,7 @@ static void FreeJumptableInfo( ClientData clientData) { - JumptableInfo *jtPtr = clientData; + JumptableInfo *jtPtr = (JumptableInfo *)clientData; Tcl_DeleteHashTable(&jtPtr->hashTable); ckfree(jtPtr); @@ -2540,7 +2533,7 @@ PrintJumptableInfo( ByteCode *codePtr, unsigned int pcOffset) { - JumptableInfo *jtPtr = clientData; + JumptableInfo *jtPtr = (JumptableInfo *)clientData; Tcl_HashEntry *hPtr; Tcl_HashSearch search; const char *keyPtr; @@ -2548,7 +2541,7 @@ PrintJumptableInfo( hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search); for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) { - keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr); + keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr); offset = PTR2INT(Tcl_GetHashValue(hPtr)); if (i++) { @@ -2569,7 +2562,7 @@ DisassembleJumptableInfo( ByteCode *codePtr, unsigned int pcOffset) { - JumptableInfo *jtPtr = clientData; + JumptableInfo *jtPtr = (JumptableInfo *)clientData; Tcl_Obj *mapping; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -2579,7 +2572,7 @@ DisassembleJumptableInfo( TclNewObj(mapping); hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search); for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) { - keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr); + keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr); offset = PTR2INT(Tcl_GetHashValue(hPtr)); Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1), Tcl_NewIntObj(offset)); @@ -2798,12 +2791,12 @@ TclCompileTryCmd( numHandlers = numWords >> 2; numWords -= numHandlers * 4; if (numHandlers > 0) { - handlerTokens = TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers); - matchClauses = TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers); + handlerTokens = (Tcl_Token**)TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers); + matchClauses = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers); memset(matchClauses, 0, sizeof(Tcl_Obj *) * numHandlers); - matchCodes = TclStackAlloc(interp, sizeof(int) * numHandlers); - resultVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers); - optionVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers); + matchCodes = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers); + resultVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers); + optionVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers); for (i=0 ; itcl_UniCharNcmp)(ucs,uct,(unsigned int)(n)) + ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))(void *)tclStubsPtr->tcl_UniCharNcmp)(ucs,uct,(unsigned int)(n)) # define Tcl_UtfNcmp(s1,s2,n) \ - ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n)) + ((int(*)(const char*,const char*,unsigned int))(void *)tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n)) # define Tcl_UtfNcasecmp(s1,s2,n) \ - ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n)) + ((int(*)(const char*,const char*,unsigned int))(void *)tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n)) # define Tcl_UniCharNcasecmp(ucs,uct,n) \ - ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n)) + ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))(void *)tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n)) # endif #endif diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index eb4ae78..4fd7c04 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -139,7 +139,6 @@ Tcl_PutsObjCmd( chanObjPtr = objv[2]; string = objv[3]; break; -#if TCL_MAJOR_VERSION < 9 } else if (strcmp(TclGetString(objv[3]), "nonewline") == 0) { /* * The code below provides backwards compatibility with an old @@ -151,7 +150,6 @@ Tcl_PutsObjCmd( chanObjPtr = objv[1]; string = objv[2]; break; -#endif } /* Fall through */ default: /* [puts] or @@ -441,7 +439,6 @@ Tcl_ReadObjCmd( if (i < objc) { if ((TclGetIntFromObj(interp, objv[i], &toRead) != TCL_OK) || (toRead < 0)) { -#if TCL_MAJOR_VERSION < 9 /* * The code below provides backwards compatibility with an old * form of the command that is no longer recommended or @@ -450,16 +447,13 @@ Tcl_ReadObjCmd( */ if (strcmp(TclGetString(objv[i]), "nonewline") != 0) { -#endif Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected non-negative integer but got \"%s\"", TclGetString(objv[i]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); return TCL_ERROR; -#if TCL_MAJOR_VERSION < 9 } newline = 1; -#endif } } @@ -954,7 +948,7 @@ Tcl_ExecObjCmd( */ argc = objc - skip; - argv = TclStackAlloc(interp, (unsigned)(argc + 1) * sizeof(char *)); + argv = (const char **)TclStackAlloc(interp, (unsigned)(argc + 1) * sizeof(char *)); /* * Copy the string conversions of each (post option) object into the @@ -1232,13 +1226,13 @@ TcpAcceptCallbacksDeleteProc( * was registered. */ Tcl_Interp *interp) /* Interpreter being deleted - not used. */ { - Tcl_HashTable *hTblPtr = clientData; + Tcl_HashTable *hTblPtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *hPtr; Tcl_HashSearch hSearch; for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - AcceptCallback *acceptCallbackPtr = Tcl_GetHashValue(hPtr); + AcceptCallback *acceptCallbackPtr = (AcceptCallback *)Tcl_GetHashValue(hPtr); acceptCallbackPtr->interp = NULL; } @@ -1280,10 +1274,10 @@ RegisterTcpServerInterpCleanup( Tcl_HashEntry *hPtr; /* Entry for this record. */ int isNew; /* Is the entry new? */ - hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL); + hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL); if (hTblPtr == NULL) { - hTblPtr = ckalloc(sizeof(Tcl_HashTable)); + hTblPtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks", TcpAcceptCallbacksDeleteProc, hTblPtr); @@ -1326,7 +1320,7 @@ UnregisterTcpServerInterpCleanupProc( Tcl_HashTable *hTblPtr; Tcl_HashEntry *hPtr; - hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL); + hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL); if (hTblPtr == NULL) { return; } @@ -1364,7 +1358,7 @@ AcceptCallbackProc( char *address, /* Address of client that was accepted. */ int port) /* Port of client that was accepted. */ { - AcceptCallback *acceptCallbackPtr = callbackData; + AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData; /* * Check if the callback is still valid; the interpreter may have gone @@ -1443,7 +1437,7 @@ TcpServerCloseProc( ClientData callbackData) /* The data passed in the call to * Tcl_CreateCloseHandler. */ { - AcceptCallback *acceptCallbackPtr = callbackData; + AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData; /* The actual data. */ if (acceptCallbackPtr->interp != NULL) { @@ -1587,10 +1581,10 @@ Tcl_SocketObjCmd( } if (server) { - AcceptCallback *acceptCallbackPtr = + AcceptCallback *acceptCallbackPtr = (AcceptCallback *) ckalloc(sizeof(AcceptCallback)); unsigned len = strlen(script) + 1; - char *copyScript = ckalloc(len); + char *copyScript = (char *)ckalloc(len); memcpy(copyScript, script, len); acceptCallbackPtr->script = copyScript; diff --git a/generic/tclListObj.c b/generic/tclListObj.c index f0bd53e..b2d6228 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -594,18 +594,18 @@ Tcl_ListObjAppendElement( attempt = 2 * numRequired; if (attempt <= LIST_MAX) { - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr == NULL) { attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH; if (attempt > LIST_MAX) { attempt = LIST_MAX; } - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr == NULL) { attempt = numRequired; - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr) { listRepPtr = newPtr; @@ -916,18 +916,18 @@ Tcl_ListObjReplace( List *newPtr = NULL; int attempt = 2 * numRequired; if (attempt <= LIST_MAX) { - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr == NULL) { attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH; if (attempt > LIST_MAX) { attempt = LIST_MAX; } - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr == NULL) { attempt = numRequired; - newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); + newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt)); } if (newPtr) { listRepPtr = newPtr; @@ -993,11 +993,7 @@ Tcl_ListObjReplace( if (listRepPtr == NULL) { for (i = 0; i < objc; i++) { /* See bug 3598580 */ -#if TCL_MAJOR_VERSION > 8 - Tcl_DecrRefCount(objv[i]); -#else objv[i]->refCount--; -#endif } return TCL_ERROR; } @@ -1536,7 +1532,7 @@ TclLsetFlat( * Clear away our internalrep surgery mess. */ - chainPtr = objPtr->internalRep.twoPtrValue.ptr2; + chainPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2; objPtr->internalRep.twoPtrValue.ptr2 = NULL; } @@ -1896,7 +1892,7 @@ SetListFromAny( TclNewStringObj(*elemPtrs, elemStart, elemSize); } else { TclNewObj(*elemPtrs); - (*elemPtrs)->bytes = ckalloc((unsigned) elemSize + 1); + (*elemPtrs)->bytes = (char *)ckalloc((unsigned) elemSize + 1); (*elemPtrs)->length = TclCopyAndCollapse(elemSize, elemStart, (*elemPtrs)->bytes); } @@ -1980,7 +1976,7 @@ UpdateStringOfList( * We know numElems <= LIST_MAX, so this is safe. */ - flagPtr = ckalloc(numElems); + flagPtr = (char *)ckalloc(numElems); } elemPtrs = &listRepPtr->elements; for (i = 0; i < numElems; i++) { @@ -2015,7 +2011,7 @@ UpdateStringOfList( * */ - listPtr->bytes = ckalloc(bytesNeeded); + listPtr->bytes = (char *)ckalloc(bytesNeeded); dst = listPtr->bytes; for (i = 0; i < numElems; i++) { flagPtr[i] |= (i ? TCL_DONT_QUOTE_HASH : 0); -- cgit v0.12 From 24f3e6199df4d1d67e475415d067d4cfcab3d5ad Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Jun 2023 13:10:36 +0000 Subject: Use more strict compilation-flags (but not -DTCL_MEM_DEBUG) in unix/dltest/Makefile --- unix/dltest/Makefile.in | 42 +++++++++++++++++++++++------------------- unix/dltest/pkgooa.c | 6 ++---- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/unix/dltest/Makefile.in b/unix/dltest/Makefile.in index 25b9376..a82f643 100644 --- a/unix/dltest/Makefile.in +++ b/unix/dltest/Makefile.in @@ -17,19 +17,23 @@ TCL_VERSION= @TCL_VERSION@ CFLAGS_DEBUG = @CFLAGS_DEBUG@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ -CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ +CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -DTCL_NO_DEPRECATED=1 -Wall -Wextra -Wc++-compat -Wconversion -Werror LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@ -CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic -DTCL_MEM_DEBUG \ +CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic \ ${SHLIB_CFLAGS} -DUSE_TCL_STUBS ${AC_FLAGS} -all: pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX} pkgua${SHLIB_SUFFIX} pkgooa${SHLIB_SUFFIX} +all: pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} \ + pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX} pkgua${SHLIB_SUFFIX} \ + pkgooa${SHLIB_SUFFIX} @if test -n "$(DLTEST_SUFFIX)"; then $(MAKE) dltest_suffix; fi @touch ../dltest.marker -dltest_suffix: pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX} pkgd${DLTEST_SUFFIX} pkge${DLTEST_SUFFIX} pkgua${DLTEST_SUFFIX} pkgooa${DLTEST_SUFFIX} +dltest_suffix: pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX} \ + pkgd${DLTEST_SUFFIX} pkge${DLTEST_SUFFIX} pkgua${DLTEST_SUFFIX} \ + pkgooa${DLTEST_SUFFIX} @touch ../dltest.marker pkga.o: $(SRC_DIR)/pkga.c @@ -54,49 +58,49 @@ pkgooa.o: $(SRC_DIR)/pkgooa.c $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgooa.c pkga${SHLIB_SUFFIX}: pkga.o - ${SHLIB_LD} -o pkga${SHLIB_SUFFIX} pkga.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkga.o ${SHLIB_LD_LIBS} pkgb${SHLIB_SUFFIX}: pkgb.o - ${SHLIB_LD} -o pkgb${SHLIB_SUFFIX} pkgb.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkgb.o ${SHLIB_LD_LIBS} pkgc${SHLIB_SUFFIX}: pkgc.o - ${SHLIB_LD} -o pkgc${SHLIB_SUFFIX} pkgc.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS} pkgd${SHLIB_SUFFIX}: pkgd.o - ${SHLIB_LD} -o pkgd${SHLIB_SUFFIX} pkgd.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS} pkge${SHLIB_SUFFIX}: pkge.o - ${SHLIB_LD} -o pkge${SHLIB_SUFFIX} pkge.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkge.o ${SHLIB_LD_LIBS} pkgua${SHLIB_SUFFIX}: pkgua.o - ${SHLIB_LD} -o pkgua${SHLIB_SUFFIX} pkgua.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkgua.o ${SHLIB_LD_LIBS} pkgooa${SHLIB_SUFFIX}: pkgooa.o - ${SHLIB_LD} -o pkgooa${SHLIB_SUFFIX} pkgooa.o ${SHLIB_LD_LIBS} + ${SHLIB_LD} -o $@ pkgooa.o ${SHLIB_LD_LIBS} pkga${DLTEST_SUFFIX}: pkga.o - ${DLTEST_LD} -o pkga${DLTEST_SUFFIX} pkga.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkga.o ${SHLIB_LD_LIBS} pkgb${DLTEST_SUFFIX}: pkgb.o - ${DLTEST_LD} -o pkgb${DLTEST_SUFFIX} pkgb.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkgb.o ${SHLIB_LD_LIBS} pkgc${DLTEST_SUFFIX}: pkgc.o - ${DLTEST_LD} -o pkgc${DLTEST_SUFFIX} pkgc.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS} pkgd${DLTEST_SUFFIX}: pkgd.o - ${DLTEST_LD} -o pkgd${DLTEST_SUFFIX} pkgd.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS} pkge${DLTEST_SUFFIX}: pkge.o - ${DLTEST_LD} -o pkge${DLTEST_SUFFIX} pkge.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkge.o ${SHLIB_LD_LIBS} pkgua${DLTEST_SUFFIX}: pkgua.o - ${DLTEST_LD} -o pkgua${DLTEST_SUFFIX} pkgua.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkgua.o ${SHLIB_LD_LIBS} pkgooa${DLTEST_SUFFIX}: pkgooa.o - ${DLTEST_LD} -o pkgooa${DLTEST_SUFFIX} pkgooa.o ${SHLIB_LD_LIBS} + ${DLTEST_LD} -o $@ pkgooa.o ${SHLIB_LD_LIBS} clean: - rm -f *.o lib.exp ../dltest.marker + rm -f embtest *.o lib.exp ../dltest.marker @if test "$(SHLIB_SUFFIX)" != ""; then \ echo "rm -f *${SHLIB_SUFFIX}" ; \ rm -f *${SHLIB_SUFFIX} ; \ diff --git a/unix/dltest/pkgooa.c b/unix/dltest/pkgooa.c index d731e48..aed89fe 100644 --- a/unix/dltest/pkgooa.c +++ b/unix/dltest/pkgooa.c @@ -84,10 +84,8 @@ static TclOOStubs stubsCopy = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL -#ifdef Tcl_MethodIsPrivate - ,NULL -#endif + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL }; DLLEXPORT int -- cgit v0.12 From 04249bbcd7751a80282d824f8d0bc67aa41e472e Mon Sep 17 00:00:00 2001 From: griffin Date: Fri, 30 Jun 2023 19:02:34 +0000 Subject: Test update for bug [63530267aa]. Fix 32-bit embtest build issue. --- tests/lseq.test | 34 +++++++++++++++++++++++++++++----- unix/dltest/Makefile.in | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tests/lseq.test b/tests/lseq.test index c7b0079..3561d44 100644 --- a/tests/lseq.test +++ b/tests/lseq.test @@ -18,6 +18,7 @@ testConstraint arithSeriesDouble 1 testConstraint arithSeriesShimmer 1 testConstraint arithSeriesShimmerOk 1 testConstraint has64BitLengths [expr {$tcl_platform(pointerSize) == 8}] +testConstraint has32BitLengths [expr {$tcl_platform(pointerSize) == 4}] # Arg errors test lseq-1.1 {error cases} -body { @@ -436,7 +437,7 @@ test lseq-3.30 {lreverse with double values} -constraints arithSeriesDouble -bod arithseries 18.5 17.0 15.5 14.0 12.5 11.0 9.5 8.0 6.5 5.0 3.5} -test lseq-3.31 {lreverse inplace with doubles} {arithSeriesDouble has64BitLengths} { +test lseq-3.31 {lreverse inplace with doubles} {arithSeriesDouble} { lreverse [lseq 1.1 29.9 0.3] } {29.9 29.6 29.3 29.0 28.7 28.4 28.1 27.8 27.5 27.2 26.9 26.6 26.3 26.0 25.7 25.4 25.1 24.8 24.5 24.2 23.9 23.6 23.3 23.0 22.7 22.4 22.1 21.8 21.5 21.2 20.9 20.6 20.3 20.0 19.7 19.4 19.1 18.8 18.5 18.2 17.9 17.6 17.3 17.0 16.7 16.4 16.1 15.8 15.5 15.2 14.9 14.6 14.3 14.0 13.7 13.4 13.1 12.8 12.5 12.2 11.9 11.6 11.3 11.0 10.7 10.4 10.1 9.8 9.5 9.2 8.9 8.6 8.3 8.0 7.7 7.4 7.1 6.8 6.5 6.2 5.9 5.6 5.3 5.0 4.7 4.4 4.1 3.8 3.5 3.2 2.9 2.6 2.3 2.0 1.7 1.4 1.1} @@ -540,6 +541,25 @@ test lseq-4.4 {lseq corner case} -constraints has64BitLengths -body { unset res s e tcmd } -result {0 10 0 10 0 9223372036854774991 0 10 0 2147483638} +test lseq-4.4.32 {lseq corner case} -constraints has32BitLengths -body { + set tcmd { + set res {} + set s [catch {lindex [lseq 10 100] 0} e] + lappend res $s $e + set s [catch {lindex [lseq 10 9223372036854775000] 0} e] + lappend res $s $e + set s [catch {llength [lseq 10 9223372036854775000]} e] + lappend res $s $e + set s [catch {lindex [lseq 10 2147483647] 0} e] + lappend res $s $e + set s [catch {llength [lseq 10 2147483647]} e] + lappend res $s $e + } + eval $tcmd +} -cleanup { + unset res s e tcmd +} -result {0 10 1 {max length of a Tcl list exceeded} 1 {max length of a Tcl list exceeded} 0 10 0 2147483638} + # Ticket 99e834bf33 - lseq, lindex end off by one test lseq-4.5 {lindex off by one} -body { @@ -590,7 +610,7 @@ test lseq-4.10 {panic using variable index} -body { lindex [lseq 10] $i } -cleanup {unset i} -result {0} -test lseq-4.11 {bug lseq / lindex discrepancies} -constraints has64BitLengths -body { +test lseq-4.11 {bug lseq / lindex discrepancies} -body { lindex [lseq 0x7fffffff] 0x80000000 } -result {} @@ -598,7 +618,11 @@ test lseq-4.12 {bug lseq} -constraints has64BitLengths -body { llength [lseq 0x100000000] } -result {4294967296} -test lseq-4.13 {bug lseq} -constraints {has64BitLengths knownBug} -body { +test lseq-4.12.32 {bug lseq} -constraints has32BitLengths -body { + llength [lseq 0x100000000] +} -returnCodes 1 -result {max length of a Tcl list exceeded} + +test lseq-4.13 {bug lseq} -constraints knownBug -body { set l [lseq 0x7fffffffffffffff] list \ [llength $l] \ @@ -607,12 +631,12 @@ test lseq-4.13 {bug lseq} -constraints {has64BitLengths knownBug} -body { } -cleanup {unset l} -result {9223372036854775807 9223372036854775806 9223372036854775800} -test lseq-4.14 {bug lseq - inconsistent rounding} has64BitLengths { +test lseq-4.14 {bug lseq - inconsistent rounding} { # using a non-integer increment, [lseq] rounding seems to be not consistent: lseq 4 40 0.1 } {4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0} -test lseq-4.15 {bug lseq - inconsistent rounding} has64BitLengths { +test lseq-4.15 {bug lseq - inconsistent rounding} { # using a non-integer increment, [lseq] rounding seems to be not consistent: lseq 6 40 0.1 } {6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0} diff --git a/unix/dltest/Makefile.in b/unix/dltest/Makefile.in index 2b7a8ec..06d0e30 100644 --- a/unix/dltest/Makefile.in +++ b/unix/dltest/Makefile.in @@ -79,7 +79,7 @@ pkgooa.o: $(SRC_DIR)/pkgooa.c $(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgooa.c embtest: embtest.o - $(CC) -o $@ embtest.o ${SHLIB_LD_LIBS} + $(CC) $(CC_SWITCHES) -o $@ embtest.o ${SHLIB_LD_LIBS} tcl9pkgπ${SHLIB_SUFFIX}: pkgπ.o ${SHLIB_LD} -o $@ pkgπ.o ${SHLIB_LD_LIBS} -- cgit v0.12