Index: generic/nsf.c =================================================================== diff -u -r9e705a33b5e8c31302030be67bb6fd77c1c3d4d6 -re01e30551cfcc79872de5b8a08a31258e3414c97 --- generic/nsf.c (.../nsf.c) (revision 9e705a33b5e8c31302030be67bb6fd77c1c3d4d6) +++ generic/nsf.c (.../nsf.c) (revision e01e30551cfcc79872de5b8a08a31258e3414c97) @@ -7731,7 +7731,7 @@ /* * The oid might be freed already, we can't even use - * (((Command *)oid)->flags & CMD_IS_DELETED) + * TclIsCommandDeleted(oid) */ if (object->teardown != NULL && oid != NULL) { /* @@ -8078,8 +8078,8 @@ * CmdListRemoveDeleted -- * * Remove all command pointers from a command list which are marked - * "deleted". The condition for deletion is the presence of the flag - * CMD_IS_DELETED, with the flag bit being set by + * "deleted". The condition for deletion is the presence of the flag + * CMD_DYING (previously, CMD_IS_DELETED), with the flag bit being set by * Tcl_DeleteCommandFromToken(). * * Results: @@ -8103,14 +8103,14 @@ f = *cmdList; while (f != NULL) { /* - * HIDDEN OBJECTS: For supporting hidden mixins, we cannot rely on - * the cmdEpoch as indicator of the deletion status of a cmd because - * the epoch counters of hidden and re-exposed commands are - * bumped. Despite of this, their object structures remain valid. We - * resort to the use of the per-cmd flag CMD_IS_DELETED, set upon + * HIDDEN OBJECTS: For supporting hidden mixins, we cannot rely on the + * cmdEpoch as indicator of the deletion status of a cmd because the epoch + * counters of hidden and re-exposed commands are bumped. Despite of this, + * their object structures remain valid. We resort to the use of the + * per-cmd flag CMD_DYING (previously, CMD_IS_DELETED), set upon * processing a command in Tcl_DeleteCommandFromToken(). */ - if (((unsigned int)Tcl_Command_flags(f->cmdPtr) & CMD_IS_DELETED) != 0u) { + if (TclIsCommandDeleted(f->cmdPtr)) { del = f; f = f->nextPtr; del = CmdListRemoveFromList(cmdList, del); @@ -9245,7 +9245,7 @@ NsfCmdList *new; assert(mixinCl != NULL); - assert(((unsigned int)Tcl_Command_flags(mixinCl->object.id) & CMD_IS_DELETED) == 0); + assert(!TclIsCommandDeleted(mixinCl->object.id)); new = CmdListAdd(mixinList, mixinCl->object.id, NULL, /*noDuplicates*/ NSF_TRUE, NSF_TRUE); @@ -9654,7 +9654,7 @@ /* * There should be no deleted commands in the list. */ - assert(((unsigned int)Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); + assert(!TclIsCommandDeleted(m->cmdPtr)); class = NsfGetClassFromCmdPtr(m->cmdPtr); assert(class != NULL); @@ -9678,7 +9678,7 @@ /* * There should not be deleted commands in the list. */ - assert(((unsigned int)Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); + assert(!TclIsCommandDeleted(m->cmdPtr)); object = NsfGetObjectFromCmdPtr(m->cmdPtr); assert(object != NULL); @@ -9748,7 +9748,7 @@ /* * We must not have deleted commands in the list */ - assert(((unsigned int)Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); + assert(!TclIsCommandDeleted(m->cmdPtr)); class = NsfGetClassFromCmdPtr(m->cmdPtr); assert(class != NULL); @@ -9938,7 +9938,7 @@ /* * Make sure, there are no deleted commands in the list. */ - assert(((unsigned int)Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); + assert(!TclIsCommandDeleted(m->cmdPtr)); class = NsfGetClassFromCmdPtr(m->cmdPtr); assert(class != NULL); @@ -10535,7 +10535,7 @@ /* * Ignore deleted commands */ - if (((unsigned int)Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED) != 0u) { + if (TclIsCommandDeleted(cmdList->cmdPtr)) { continue; } @@ -10590,7 +10590,7 @@ /* * Ignore deleted commands */ - if (((unsigned int)Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED) != 0u) { + if (TclIsCommandDeleted(cmdList->cmdPtr)) { continue; } class = NsfGetClassFromCmdPtr(cmdList->cmdPtr); @@ -19201,8 +19201,7 @@ /*fprintf(stderr, "NsfProcStub %s is called, tcd %p, paramDefs %p\n", ObjStr(objv[0]), tcd, tcd ? tcd->paramDefs : NULL);*/ - if ((((unsigned int)Tcl_Command_flags(tcd->cmd) & CMD_IS_DELETED) == 0u) || - Tcl_Command_cmdEpoch(tcd->cmd) != 0) { + if (!TclIsCommandDeleted(tcd->cmd) || Tcl_Command_cmdEpoch(tcd->cmd) != 0) { /* * It seems as if the (cached) command was deleted (e.g., rename), or * someone messed around with the shadowed proc. @@ -27401,8 +27400,8 @@ /*fprintf(stderr, "cmd %p epoch %d deleted %.6x\n", cmd, Tcl_Command_cmdEpoch(cmd), - Tcl_Command_flags(cmd) & CMD_IS_DELETED);*/ - if (((unsigned int)Tcl_Command_flags(cmd) & CMD_IS_DELETED) != 0u) { + TclIsCommandDeleted(cmd));*/ + if (TclIsCommandDeleted(cmd)) { cmd = NULL; } } @@ -35308,15 +35307,15 @@ /* * The list of the instances should contain only alive objects, without * duplicates. We would recognize duplicates since a deletion of one - * object would trigger the CMD_IS_DELETED flag of the cmdPtr of the - * duplicate. + * object would result in the CMD_DYING (previously, CMD_IS_DELETED) + * flag becoming set on the cmdPtr of the duplicate. */ - assert(((unsigned int)Tcl_Command_flags(entry->cmdPtr) & CMD_IS_DELETED) == 0u); + assert(!TclIsCommandDeleted(entry->cmdPtr)); if (object != NULL && !NsfObjectIsClass(object) && !ObjectHasChildren(object)) { /*fprintf(stderr, "check %p obj->flags %.6x cmd %p deleted %d\n", object, object->flags, entry->cmdPtr, - Tcl_Command_flags(entry->cmdPtr) & CMD_IS_DELETED); */ + TclIsCommandDeleted(entry->cmdPtr)); */ assert(object->id != NULL); /*fprintf(stderr, " ... delete object %s %p, class=%s id %p ns %p\n", ObjectName(object), object, Index: generic/nsfAccessInt.h =================================================================== diff -u -r8024df76962dab57646dc206e07a7ae66e7990ad -re01e30551cfcc79872de5b8a08a31258e3414c97 --- generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision 8024df76962dab57646dc206e07a7ae66e7990ad) +++ generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision e01e30551cfcc79872de5b8a08a31258e3414c97) @@ -107,3 +107,25 @@ #if !defined(Tcl_HashSize) # define Tcl_HashSize(tablePtr) ((tablePtr)->numEntries) #endif + +/* + * Starting with [ebe34426255bef25], in Sep 2020, the macro + * CMD_IS_DELETED has been replaced by CMD_DYING. + * + * See also: + * + * https://core.tcl-lang.org/tcl/info/ebe34426255bef25 + * + * https://github.com/tcltk/tcl/commit/23d0bb6cb4e614f464b8e217aa4c7891479e29ff#diff-f9e920c8cca3df7e99caa9e277d717cd736481f4bc54d7df5014a59712ca6397L1731 + * + */ + +#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>6 && defined(CMD_DYING) +#define TclIsCommandDeleted(cmdPtr) (((unsigned int)Tcl_Command_flags((cmdPtr)) & CMD_DYING) != 0u) +#else +#define TclIsCommandDeleted(cmdPtr) (((unsigned int)Tcl_Command_flags((cmdPtr)) & CMD_IS_DELETED) != 0u) +#endif + + + + Index: generic/nsfObj.c =================================================================== diff -u -r84ebec01747d68ec9ab8310c0aba7dfd6a2af522 -re01e30551cfcc79872de5b8a08a31258e3414c97 --- generic/nsfObj.c (.../nsfObj.c) (revision 84ebec01747d68ec9ab8310c0aba7dfd6a2af522) +++ generic/nsfObj.c (.../nsfObj.c) (revision e01e30551cfcc79872de5b8a08a31258e3414c97) @@ -587,7 +587,7 @@ * We got a mixin with an included cmd, but both might have been deleted already. */ if ((mixinRegPtr->mixin->object.flags & NSF_DELETED) != 0u - || (Tcl_Command_flags(mixinRegPtr->mixin->object.id) & CMD_IS_DELETED) != 0u) { + || TclIsCommandDeleted(mixinRegPtr->mixin->object.id)) { /* * The cmd is deleted. Try to refetch it.