Index: TODO =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- TODO (.../TODO) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ TODO (.../TODO) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -5646,9 +5646,32 @@ - generalized NsfReplaceCommand* logic to become more general usable (e.g. for the builtins mechanism of nsf::__profile_trace) +- New macros NSF_nonnull_assert() and nonnull_assert() + Background: The unreleased gcc6 with "-pedantic" + complaints since recently about asserts, in which nonnull + conditions implied by nonnull declarations are explicitly + tested, and spits out warnings like + ... warning: nonnull argument ... compared to NULL ... + The new macros turns off asserts, when gcc6 is used. + ======================================================================== TODO: +- gcc6: + * ISOBJ(methodObj); will raise a warning, when methodObj is decared as nonnull + * Same with ObjectName() and ClassName() + * gcc6 seems to have a bug: when e.g. a variable "foo" is declared as nonnull, + then the construct + + do { + ... + foo = foo->nextPtr; + } while (foo != NULL); + + whill raise a warning, despite of the fact that foo is overwritten. + * a few more for-loops have to be turned into do/while loops to avaid the warnings. + + - maybe use as well "$obj eval $cmd" for valuechangedcmd Consequence: commands like the folowings become more complicated ::nx Class { Index: generic/gentclAPI.tcl =================================================================== diff -u -rcad3e31c72e3d35d75e67c8ceb7f6a1a775336e1 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision cad3e31c72e3d35d75e67c8ceb7f6a1a775336e1) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -367,7 +367,7 @@ if {[dict get $::definitions($key) clientData] ne ""} { set stubNN "NSF_nonnull(1) " set NN " NSF_nonnull(2)" - regsub \n\n $intro "\n\n assert(clientData != NULL);\n" intro + regsub \n\n $intro "\n\n NSF_nonnull_assert(clientData != NULL);\n" intro } else { set stubNN "" set NN "" Index: generic/nsf.c =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsf.c (.../nsf.c) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsf.c (.../nsf.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -468,8 +468,8 @@ NsfErrorContext(Tcl_Interp *interp, const char *context) { Tcl_DString ds, *dsPtr = &ds; - assert(interp != NULL); - assert(context != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(context != NULL); Tcl_DStringInit(dsPtr); Tcl_DStringAppend(dsPtr, "puts stderr \"Error in ", -1); @@ -483,7 +483,7 @@ static char * NsfErrorInfo(Tcl_Interp *interp) { Tcl_Obj *valueObj; - assert(interp != NULL); + nonnull_assert(interp != NULL); valueObj = Tcl_GetVar2Ex(interp, "::errorInfo", NULL, TCL_GLOBAL_ONLY); if (valueObj != NULL) { @@ -515,9 +515,9 @@ NsfDStringEval(Tcl_Interp *interp, Tcl_DString *dsPtr, const char *context) { int result = Tcl_EvalEx(interp, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), 0); - assert(interp != NULL); - assert(dsPtr != NULL); - assert(context != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(context != NULL); if (unlikely(result == TCL_ERROR)) { NsfErrorContext(interp, context); @@ -545,8 +545,8 @@ void NsfLog(Tcl_Interp *interp, int requiredLevel, const char *fmt, ...) { - assert(interp != NULL); - assert(fmt != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(fmt != NULL); if (RUNTIME_STATE(interp)->debugLevel >= requiredLevel) { Tcl_DString cmdString, ds; @@ -599,10 +599,10 @@ NsfDeprecatedCmd(Tcl_Interp *interp, const char *what, const char *oldCmd, const char *newCmd) { Tcl_DString ds, *dsPtr = &ds; - assert(interp != NULL); - assert(newCmd != NULL); - assert(what != NULL); - assert(oldCmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(newCmd != NULL); + nonnull_assert(what != NULL); + nonnull_assert(oldCmd != NULL); Tcl_DStringInit(dsPtr); Tcl_DStringAppendElement(dsPtr, "::nsf::deprecated"); @@ -640,8 +640,8 @@ static void ParseContextInit(ParseContext *pcPtr, int objc, NsfObject *object, Tcl_Obj *procName) { - assert(pcPtr != NULL); - assert(procName != NULL); + nonnull_assert(pcPtr != NULL); + nonnull_assert(procName != NULL); if (likely(objc < PARSE_CONTEXT_PREALLOC)) { /* the single larger memset below .... */ @@ -694,8 +694,8 @@ ParseContextExtendObjv(ParseContext *pcPtr, int from, int elts, Tcl_Obj *CONST source[]) { int requiredSize = from + elts + 1; - assert(pcPtr != NULL); - assert(source != NULL); + nonnull_assert(pcPtr != NULL); + nonnull_assert(source != NULL); /*NsfPrintObjv("BEFORE: ", pcPtr->objc, pcPtr->full_objv);*/ @@ -751,7 +751,7 @@ ParseContextRelease(ParseContext *pcPtr) { int status; - assert(pcPtr != NULL); + nonnull_assert(pcPtr != NULL); status = pcPtr->status; @@ -881,9 +881,9 @@ int result; ALLOC_ON_STACK(Tcl_Obj*, objc, tov); - assert(clientData != NULL); - assert(interp != NULL); - assert(methodObj != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodObj != NULL); assert(objc > 1); object = (NsfObject *) clientData; @@ -935,8 +935,8 @@ int result; ALLOC_ON_STACK(Tcl_Obj*, objc, tov); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); assert(ISOBJ(methodObj)); assert(objc > 1); @@ -968,8 +968,8 @@ Var *varPtr = NULL; Tcl_HashEntry *hPtr; - assert(tablePtr != NULL); - assert(key != NULL); + nonnull_assert(tablePtr != NULL); + nonnull_assert(key != NULL); hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) tablePtr, (char *) key, newPtr); @@ -1020,8 +1020,8 @@ static Tcl_HashEntry * Nsf_NextHashEntry(Tcl_HashTable *tablePtr, int expected, Tcl_HashSearch *hSrchPtr) { - assert(tablePtr != NULL); - assert(hSrchPtr != NULL); + nonnull_assert(tablePtr != NULL); + nonnull_assert(hSrchPtr != NULL); /*fprintf(stderr, "Nsf_NextHashEntry %p expected %d numEntries %d\n", tablePtr, expected, tablePtr->numEntries);*/ @@ -1051,7 +1051,7 @@ static void NsfCommandPreserve(Tcl_Command cmd) { - assert(cmd != NULL); + nonnull_assert(cmd != NULL); Tcl_Command_refCount(cmd)++; MEM_COUNT_ALLOC("command.refCount", cmd); @@ -1074,7 +1074,7 @@ static void NsfCommandRelease(Tcl_Command cmd) { - assert(cmd != NULL); + nonnull_assert(cmd != NULL); /*fprintf(stderr,"NsfCommandRelease %p\n", cmd);*/ MEM_COUNT_FREE("command.refCount", cmd); @@ -1112,28 +1112,28 @@ Nsf_Object * NsfGetSelfObj(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); return (Nsf_Object *) GetSelfObj(interp); } Nsf_Object * NsfGetObject(Tcl_Interp *interp, const char *name) { - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); return (Nsf_Object *) GetObjectFromString(interp, name); } Nsf_Class * NsfGetClass(Tcl_Interp *interp, const char *name) { - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); return (Nsf_Class *)GetClassFromString(interp, name); } Nsf_Class * NsfIsClass(Tcl_Interp *UNUSED(interp), ClientData clientData) { - assert(clientData != NULL); + nonnull_assert(clientData != NULL); if (NsfObjectIsClass((NsfObject *)clientData)) { return (Nsf_Class *) clientData; @@ -1144,8 +1144,8 @@ void NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); RequireObjNamespace(interp, (NsfObject *) object); } @@ -1156,10 +1156,10 @@ Tcl_Obj *result; CallFrame frame, *framePtr = &frame; - assert(object != NULL); - assert(interp != NULL); - assert(name1 != NULL); - assert(valueObj != NULL); + nonnull_assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name1 != NULL); + nonnull_assert(valueObj != NULL); Nsf_PushFrameObj(interp, (NsfObject *)object, framePtr); if (((NsfObject *)object)->nsPtr) { @@ -1177,9 +1177,9 @@ Tcl_Obj *result; CallFrame frame, *framePtr = &frame; - assert(object != NULL); - assert(interp != NULL); - assert(name1 != NULL); + nonnull_assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name1 != NULL); Nsf_PushFrameObj(interp, (NsfObject *)object, framePtr); if (((NsfObject *)object)->nsPtr) { @@ -1198,10 +1198,10 @@ NsfObject *object; int result; - assert(object1 != NULL); - assert(interp != NULL); - assert(name1 != NULL); - assert(name2 != NULL); + nonnull_assert(object1 != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name1 != NULL); + nonnull_assert(name2 != NULL); object = (NsfObject *) object1; Nsf_PushFrameObj(interp, object, framePtr); @@ -1220,10 +1220,10 @@ int result; ALLOC_ON_STACK(Tcl_Obj *, objc+2, ov); - assert(interp != NULL); - assert(class != NULL); - assert(nameObj != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(objv != NULL); INCR_REF_COUNT2("nameObj", nameObj); @@ -1243,8 +1243,8 @@ int NsfDeleteObject(Tcl_Interp *interp, Nsf_Object *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return DispatchDestroyMethod(interp, (NsfObject *)object, 0); } @@ -1253,9 +1253,9 @@ NsfRemoveObjectMethod(Tcl_Interp *interp, Nsf_Object *object1, const char *methodName) { NsfObject *object; - assert(interp != NULL); - assert(object1 != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object1 != NULL); + nonnull_assert(methodName != NULL); object = (NsfObject *) object1; /*fprintf(stderr, "... NsfRemoveObjectMethod %s %s\n", ObjectName(object), methodName);*/ @@ -1287,9 +1287,9 @@ NsfClassOpt *opt; #endif - assert(interp != NULL); - assert(class != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(methodName != NULL); cl = (NsfClass *)class; /*fprintf(stderr, "... NsfRemoveClassMethod %s %s\n", ClassName(class), methodName);*/ @@ -1318,9 +1318,9 @@ void NsfSetObjClientData(Tcl_Interp *interp, Nsf_Object *object, ClientData data) { - assert(interp != NULL); - assert(object != NULL); - assert(data != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(data != NULL); NsfRequireObjectOpt((NsfObject *) object) -> clientData = data; } @@ -1329,8 +1329,8 @@ NsfGetObjClientData(Tcl_Interp *interp, Nsf_Object *object) { NsfObject *object_; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); object_ = (NsfObject *) object; return (object_->opt != NULL) ? object_->opt->clientData : NULL; @@ -1339,8 +1339,8 @@ void NsfSetClassClientData(Tcl_Interp *interp, Nsf_Class *cl, ClientData data) { - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); NsfRequireClassOpt((NsfClass *)cl) -> clientData = data; } @@ -1349,8 +1349,8 @@ NsfGetClassClientData(Tcl_Interp *interp, Nsf_Class *cl) { NsfClass *cl_; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); cl_ = (NsfClass *) cl; return (cl_->opt != NULL) ? cl_->opt->clientData : NULL; @@ -1366,8 +1366,8 @@ void ObjTrace(char *string, NsfObject *object) { - assert(string != NULL); - assert(object != NULL); + nonnull_assert(string != NULL); + nonnull_assert(object != NULL); fprintf(stderr, "--- %s tcl %p %s (%d %p) nsf %p (%d) %s \n", string, object->cmdName, (object->cmdName->typePtr != NULL) ? object->cmdName->typePtr->name : "NULL", @@ -1400,7 +1400,7 @@ NSTail(const char *string) { register const char *p; - assert(string != NULL); + nonnull_assert(string != NULL); p = string + strlen(string); while (p > string) { @@ -1432,7 +1432,7 @@ NSF_INLINE static int IsClassNsName(const char *string, const char **cont) { - assert(string != NULL); + nonnull_assert(string != NULL); if (*string == ':' && strncmp((string), "::nsf::classes", 14) == 0) { if (cont != NULL) {*cont = string + 14;} @@ -1463,9 +1463,9 @@ GetObjectFromNsName(Tcl_Interp *interp, const char *string, int *fromClassNS) { const char *className; - assert(interp != NULL); - assert(string != NULL); - assert(fromClassNS != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(string != NULL); + nonnull_assert(fromClassNS != NULL); if (IsClassNsName(string, &className)) { *fromClassNS = 1; @@ -1498,9 +1498,9 @@ DStringAppendQualName(Tcl_DString *dsPtr, Tcl_Namespace *nsPtr, const char *name) { int oldLength = Tcl_DStringLength(dsPtr); - assert(dsPtr != NULL); - assert(nsPtr != NULL); - assert(name != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(name != NULL); Tcl_DStringAppend(dsPtr, nsPtr->fullName, -1); if (Tcl_DStringLength(dsPtr) > (oldLength + 2)) { @@ -1528,7 +1528,7 @@ void NsfCleanupObject_(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); NsfObjectRefCountDecr(object); /*fprintf(stderr, "NsfCleanupObject obj refCount of %p after decr %d id %p interp %p flags %.6x\n", @@ -1585,9 +1585,9 @@ TclObjIsNsfObject(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfObject **objectPtr) { Tcl_ObjType CONST86 *cmdType; - assert(interp != NULL); - assert(objPtr != NULL); - assert(objectPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(objectPtr != NULL); cmdType = objPtr->typePtr; if (cmdType == Nsf_OT_tclCmdNameType) { @@ -1628,9 +1628,9 @@ const char *string; Tcl_Command cmd; - assert(interp != NULL); - assert(objPtr != NULL); - assert(objectPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(objectPtr != NULL); /*fprintf(stderr, "GetObjectFromObj obj %p %s is of type %s\n", objPtr, ObjStr(objPtr), (objPtr->typePtr != NULL) ? objPtr->typePtr->name : "(null)");*/ @@ -1700,8 +1700,8 @@ int result; Tcl_Obj *ov[3]; - assert(interp != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); /*fprintf(stderr, "try ::nsf::object::unknown for '%s'\n", ObjStr(nameObj));*/ @@ -1730,10 +1730,10 @@ Tcl_Obj *ov[4]; int result, oc = 3; - assert(interp != NULL); - assert(methodObj != NULL); - assert(argumentObj != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodObj != NULL); + nonnull_assert(argumentObj != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "try ::nsf::argument::unknown for '%s'\n", ObjStr(nameObj));*/ @@ -1781,9 +1781,9 @@ const char *objName = ObjStr(objPtr); Tcl_Command cmd; - assert(interp != NULL); - assert(objPtr != NULL); - assert(clPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(clPtr != NULL); cmd = Tcl_GetCommandFromObj(interp, objPtr); /*fprintf(stderr, "GetClassFromObj %p %s unknown %d cmd %p\n", objPtr, objName, withUnknown, cmd);*/ @@ -1868,9 +1868,9 @@ NsfGetClassFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfClass **clPtr, int withUnknown) { - assert(interp != NULL); - assert(objPtr != NULL); - assert(clPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(clPtr != NULL); return GetClassFromObj(interp, objPtr, clPtr, withUnknown); } @@ -1900,11 +1900,11 @@ NsfClass *cl; Tcl_DString ds, *dsPtr = &ds; - assert(interp != NULL); - assert(object != NULL); - assert(what != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(what != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); if (unlikely((pPtr->flags & NSF_ARG_BASECLASS) != 0u) && !IsBaseClass(object)) { what = "baseclass"; @@ -1956,8 +1956,8 @@ Tcl_Obj *objPtr; Tcl_DString ds, *dsPtr = &ds; - assert(name != NULL); - assert(nsPtr != NULL); + nonnull_assert(name != NULL); + nonnull_assert(nsPtr != NULL); /*fprintf(stderr, "NameInNamespaceObj %s (%p, %s) ", name, nsPtr, nsPtr->fullName);*/ @@ -1992,8 +1992,8 @@ int prefixLength; NsfStringIncrStruct *iss; - assert(interp != NULL); - assert(dsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(dsPtr != NULL); prefixLength = dsPtr->length; iss = &RUNTIME_STATE(interp)->iss; @@ -2033,16 +2033,19 @@ NsfReverseClasses(NsfClasses *sl) { NsfClasses *firstPtr = NULL; - assert(sl != NULL); + nonnull_assert(sl != NULL); - for (; likely(sl != NULL); sl = sl->nextPtr) { + do { NsfClasses *element = NEW(NsfClasses); element->cl = sl->cl; element->clientData = sl->clientData; element->nextPtr = firstPtr; firstPtr = element; - } + + sl = sl->nextPtr; + } while (likely(sl != NULL)); + return firstPtr; } @@ -2066,12 +2069,13 @@ NsfClassListFree(NsfClasses *classList) { NsfClasses *nextPtr; - assert(classList != NULL); + nonnull_assert(classList != NULL); - for (; likely(classList != NULL); classList = nextPtr) { - nextPtr = classList->nextPtr; - FREE(NsfClasses, classList); - } + do { + nextPtr = classList->nextPtr; + FREE(NsfClasses, classList); + classList = nextPtr; + } while (likely(classList != NULL)); } /* @@ -2094,7 +2098,7 @@ NsfClassListAdd(NsfClasses **firstPtrPtr, NsfClass *cl, ClientData clientData) { NsfClasses *classListPtr, *element = NEW(NsfClasses); - assert(firstPtrPtr != NULL); + nonnull_assert(firstPtrPtr != NULL); element->cl = cl; element->clientData = clientData; @@ -2136,8 +2140,8 @@ NsfClassListAddNoDup(NsfClasses **firstPtrPtr, NsfClass *cl, ClientData clientData, int *isNewPtr) { NsfClasses *clPtr, **nextPtr; - assert(firstPtrPtr != NULL); - assert(cl != NULL); + nonnull_assert(firstPtrPtr != NULL); + nonnull_assert(cl != NULL); clPtr = *firstPtrPtr; if (clPtr != NULL) { @@ -2184,7 +2188,7 @@ static NsfClasses * NsfClassListFind(NsfClasses *clPtr, NsfClass *cl) { - assert(cl != NULL); + nonnull_assert(cl != NULL); for (; clPtr; clPtr = clPtr->nextPtr) { if (clPtr->cl == cl) { @@ -2219,7 +2223,7 @@ NsfClass *cl; int count = 0; - assert(title != NULL); + nonnull_assert(title != NULL); cl = (classListPtr != NULL) ? classListPtr->cl : NULL; for (; classListPtr; classListPtr = classListPtr->nextPtr) { @@ -2235,7 +2239,7 @@ static void NsfClassListPrint(const char *title, NsfClasses *clsList) { - assert(title != NULL); + nonnull_assert(title != NULL); fprintf(stderr, "%s", title); /* fprintf(stderr, " %p:", clsList); */ @@ -2272,8 +2276,8 @@ NsfClassListUnlink(NsfClasses **firstPtrPtr, void *key) { NsfClasses *entryPtr = NULL; - assert(firstPtrPtr != NULL); - assert(key != NULL); + nonnull_assert(firstPtrPtr != NULL); + nonnull_assert(key != NULL); if (*firstPtrPtr != NULL) { NsfClasses *prevPtr = NULL; @@ -2332,8 +2336,8 @@ TopoSort(NsfClass *cl, NsfClass *baseClass, ClassDirection direction, int withMixinOfs) { NsfClasses *sl, *pl; - assert(cl != NULL); - assert(baseClass != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(baseClass != NULL); sl = direction == SUPER_CLASSES ? cl->super : cl->sub; @@ -2410,9 +2414,9 @@ MustBeBefore(NsfClass *a, NsfClass *b, NsfClasses *superClasses) { int result; - assert(a != NULL); - assert(b != NULL); - assert(superClasses != NULL); + nonnull_assert(a != NULL); + nonnull_assert(b != NULL); + nonnull_assert(superClasses != NULL); assert(b->order != NULL); /* @@ -2518,8 +2522,8 @@ NsfClasses *sl, *baseList, **plNext, *superClasses, *deletionList = NULL; - assert(pl != NULL); - assert(cl != NULL); + nonnull_assert(pl != NULL); + nonnull_assert(cl != NULL); #if defined(NSF_LINEARIZER_TRACE) fprintf(stderr, "=== working on %s\n", ClassName(cl)); @@ -2720,8 +2724,8 @@ TopoSortSuper(NsfClass *cl, NsfClass *baseClass) { NsfClasses *pl, *sl; - assert(cl != NULL); - assert(baseClass != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(baseClass != NULL); /* * Be careful to reset the color of unreported classes to @@ -2807,7 +2811,7 @@ register NsfClasses *sl; int success; - assert(cl != NULL); + nonnull_assert(cl != NULL); /* * Check, of the superclass order is already cached. @@ -2900,7 +2904,7 @@ TransitiveSubClasses(NsfClass *cl) { NsfClasses *order, *savedOrder; - assert(cl != NULL); + nonnull_assert(cl != NULL); /* * Since TopoSort() places its result in cl->order, we have to save the old @@ -2950,7 +2954,7 @@ DependentSubClasses(NsfClass *cl) { NsfClasses *order, *savedOrder; - assert(cl != NULL); + nonnull_assert(cl != NULL); /* * Since TopoSort() places its result in cl->order, we have to save the old @@ -3000,7 +3004,7 @@ static void FlushPrecedences(NsfClasses *clPtr) { - assert(clPtr != NULL); + nonnull_assert(clPtr != NULL); do { if (clPtr->cl->order != NULL) { @@ -3032,8 +3036,8 @@ AddInstance(NsfObject *object, NsfClass *cl) { int isNewItem; - assert(object != NULL); - assert(cl != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cl != NULL); object->cl = cl; (void) Tcl_CreateHashEntry(&cl->instances, (char *)object, &isNewItem); @@ -3064,8 +3068,8 @@ static void RemoveInstance(NsfObject *object, NsfClass *cl) { - assert(object != NULL); - assert(cl != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cl != NULL); /* * If we are during a delete, which should not happen under normal @@ -3074,7 +3078,7 @@ if ((cl->object.flags & NSF_DURING_DELETE) != 0u) { NsfLog(cl->object.teardown, NSF_LOG_WARN, "Class which should loose instance is currently being deleted: %s", - ClassName(cl)); + ObjStr((cl)->object.cmdName)); } else { Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(&cl->instances, (char *)object, NULL); @@ -3098,8 +3102,8 @@ AddSuper1(NsfClass *s, NsfClasses **sl) { NsfClasses *sc = NEW(NsfClasses); - assert(s != NULL); - assert(sl != NULL); + nonnull_assert(s != NULL); + nonnull_assert(sl != NULL); sc->cl = s; sc->nextPtr = *sl; @@ -3108,8 +3112,10 @@ static void AddSuper(NsfClass *cl, NsfClass *super) { + + nonnull_assert(cl != NULL); + if (super != NULL) { - assert(cl != NULL); /* * keep corresponding sub in step with super */ @@ -3122,8 +3128,8 @@ RemoveSuper1(NsfClass *s, NsfClasses **sl) { NsfClasses *l; - assert(s != NULL); - assert(sl != NULL); + nonnull_assert(s != NULL); + nonnull_assert(sl != NULL); l = *sl; @@ -3151,8 +3157,8 @@ RemoveSuper(NsfClass *cl, NsfClass *super) { int sp, sb; - assert(cl != NULL); - assert(super != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(super != NULL); /* * keep corresponding sub in step with super @@ -3194,10 +3200,10 @@ Tcl_Command cmd; const char *nameString = ObjStr(name); - assert(interp != NULL); - assert(name != NULL); - assert(cmdPtr != NULL); - assert(fromClassNS != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); + nonnull_assert(cmdPtr != NULL); + nonnull_assert(fromClassNS != NULL); if (*nameString == ':') { cmd = Tcl_GetCommandFromObj(interp, name); @@ -3239,12 +3245,12 @@ const char *procName; size_t objNameLength; - assert(interp != NULL); - assert(cmd != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(methodName != NULL); assert(*methodName == ':'); - assert(fromClassNS != NULL); - assert(cmd != NULL); + nonnull_assert(fromClassNS != NULL); + nonnull_assert(cmd != NULL); procName = Tcl_GetCommandName(interp, cmd); objNameLength = strlen(methodName) - strlen(procName) - 2; @@ -3302,9 +3308,9 @@ int containsSpace, tailContainsSpace; Tcl_Command cmd; - assert(interp != NULL); - assert(methodObj != NULL); - assert(fromClassNS != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodObj != NULL); + nonnull_assert(fromClassNS != NULL); methodName = ObjStr(methodObj); @@ -3495,7 +3501,7 @@ NSF_INLINE static int CmdIsProc(Tcl_Command cmd) { /* In 8.6: TclIsProc((Command *)cmd) is not equivalent to the definition below */ - assert(cmd != NULL); + nonnull_assert(cmd != NULL); return (Tcl_Command_objProc(cmd) == TclObjInterpProc); } @@ -3517,7 +3523,7 @@ NSF_INLINE static int CmdIsNsfObject(Tcl_Command cmd) { - assert(cmd != NULL); + nonnull_assert(cmd != NULL); return Tcl_Command_objProc(cmd) == NsfObjDispatch; } @@ -3542,7 +3548,7 @@ GetTclProcFromCommand(Tcl_Command cmd) { Tcl_ObjCmdProc *proc; - assert(cmd != NULL); + nonnull_assert(cmd != NULL); proc = Tcl_Command_objProc(cmd); if (proc == TclObjInterpProc) { return (Proc *)Tcl_Command_objClientData(cmd); @@ -3569,8 +3575,8 @@ FindMethod(Tcl_Namespace *nsPtr, const char *methodName) { register Tcl_HashEntry *entryPtr; - assert(nsPtr != NULL); - assert(methodName != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(methodName != NULL); if ((entryPtr = Tcl_CreateHashEntry(Tcl_Namespace_cmdTablePtr(nsPtr), methodName, NULL))) { return (Tcl_Command) Tcl_GetHashValue(entryPtr); @@ -3598,8 +3604,8 @@ FindProcMethod(Tcl_Namespace *nsPtr, const char *methodName) { Tcl_Command cmd; - assert(nsPtr != NULL); - assert(methodName != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(methodName != NULL); cmd = FindMethod(nsPtr, methodName); return (cmd != NULL) ? GetTclProcFromCommand(cmd) : NULL; @@ -3630,9 +3636,9 @@ static NsfClass * SearchPLMethod0(register NsfClasses *pl, const char *methodName, Tcl_Command *cmdPtr) { - assert(pl != NULL); - assert(methodName != NULL); - assert(cmdPtr != NULL); + nonnull_assert(pl != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmdPtr != NULL); /* Search the precedence list (class hierarchy) */ do { @@ -3652,9 +3658,9 @@ SearchPLMethod(register NsfClasses *pl, const char *methodName, Tcl_Command *cmdPtr, unsigned int flags) { - assert(pl != NULL); - assert(methodName != NULL); - assert(cmdPtr != NULL); + nonnull_assert(pl != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmdPtr != NULL); /* Search the precedence list (class hierarchy) */ do { @@ -3698,9 +3704,9 @@ static NsfClass * SearchCMethod(/*@notnull@*/ NsfClass *cl, const char *methodName, Tcl_Command *cmdPtr) { - assert(methodName != NULL); - assert(cmdPtr != NULL); - assert(cl != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmdPtr != NULL); + nonnull_assert(cl != NULL); return SearchPLMethod0(PrecedenceOrder(cl), methodName, cmdPtr); } @@ -3729,10 +3735,10 @@ SearchSimpleCMethod(Tcl_Interp *interp, /*@notnull@*/ NsfClass *cl, Tcl_Obj *methodObj, Tcl_Command *cmdPtr) { - assert(interp != NULL); - assert(cl != NULL); - assert(methodObj != NULL); - assert(cmdPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(methodObj != NULL); + nonnull_assert(cmdPtr != NULL); return SearchPLMethod0(PrecedenceOrder(cl), ObjStr(methodObj), cmdPtr); } @@ -3763,10 +3769,10 @@ NsfClasses *pl; int fromClassNS = 1; - assert(interp != NULL); - assert(cl != NULL); - assert(methodObj != NULL); - assert(cmdPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(methodObj != NULL); + nonnull_assert(cmdPtr != NULL); for (pl = PrecedenceOrder(cl); pl; pl = pl->nextPtr) { Tcl_Command cmd = ResolveMethodName(interp, pl->cl->nsPtr, methodObj, @@ -3807,10 +3813,10 @@ NsfClass *(*lookupFunction)(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *methodObj, Tcl_Command *cmdPtr); - assert(interp != NULL); - assert(object != NULL); - assert(methodObj != NULL); - assert(pcl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObj != NULL); + nonnull_assert(pcl != NULL); if (strchr(ObjStr(methodObj), ' ') != NULL) { lookupFunction = SearchComplexCMethod; @@ -3868,11 +3874,11 @@ static NsfObjectSystem * GetObjectSystem(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); if (NsfObjectIsClass(object)) { return ((NsfClass *)object)->osPtr; } - assert(object->cl); + assert(object->cl != NULL); return object->cl->osPtr; } @@ -3897,8 +3903,8 @@ ObjectSystemFree(Tcl_Interp *interp, NsfObjectSystem *osPtr) { int idx; - assert(interp != NULL); - assert(osPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(osPtr != NULL); for (idx = 0; idx <= NSF_s_set_idx; idx++) { if (osPtr->methods[idx]) { DECR_REF_COUNT(osPtr->methods[idx]); } @@ -3936,8 +3942,8 @@ static void ObjectSystemAdd(Tcl_Interp *interp, NsfObjectSystem *osPtr) { - assert(interp != NULL); - assert(osPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(osPtr != NULL); osPtr->nextPtr = RUNTIME_STATE(interp)->objectSystems; RUNTIME_STATE(interp)->objectSystems = osPtr; @@ -3967,7 +3973,7 @@ NsfCmdList *instances = NULL, *entryPtr; NsfObjectSystem *osPtr, *nPtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); /* Deletion is performed in two rounds: * (a) SOFT DESTROY: invoke all user-defined destroy methods @@ -4080,9 +4086,9 @@ int callDirectly = 1; Tcl_Obj *methodObj; - assert(interp != NULL); - assert(object != NULL); - assert(methodObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObjPtr != NULL); methodObj = osPtr->methods[methodIdx]; /*fprintf(stderr, "OS of %s is %s, method %s methodObj %p osPtr %p defined %.8x %.8x overloaded %.8x %.8x flags %.8x\n", @@ -4152,7 +4158,7 @@ NsfMethodObj(NsfObject *object, int methodIdx) { NsfObjectSystem *osPtr = GetObjectSystem(object); - assert(object != NULL); + nonnull_assert(object != NULL); /* fprintf(stderr, "NsfMethodObj object %s os %p idx %d %s methodObj %p\n", ObjectName(object), osPtr, methodIdx, @@ -4171,7 +4177,7 @@ static NsfObjectOpt * NsfRequireObjectOpt(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); if (object->opt == NULL) { object->opt = NEW(NsfObjectOpt); @@ -4184,7 +4190,7 @@ NsfClassOpt * NsfRequireClassOpt(/*@notnull@*/ NsfClass *cl) { - assert(cl != NULL); + nonnull_assert(cl != NULL); if (cl->opt == NULL) { cl->opt = NEW(NsfClassOpt); @@ -4202,16 +4208,16 @@ static void MakeObjNamespace(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #ifdef NAMESPACE_TRACE fprintf(stderr, "+++ MakeObjNamespace for %s\n", ObjectName(object)); #endif if (object->nsPtr == NULL) { Tcl_Namespace *nsPtr; nsPtr = object->nsPtr = NSGetFreshNamespace(interp, object, - ObjectName(object)); + ObjStr((object)->cmdName)); assert(nsPtr != NULL); /* @@ -4249,8 +4255,8 @@ int i, localCt; Tcl_Obj **objPtrPtr; - assert(varFramePtr != NULL); - assert(varName != NULL); + nonnull_assert(varFramePtr != NULL); + nonnull_assert(varName != NULL); localCt = varFramePtr->numCompiledLocals; objPtrPtr = &varFramePtr->localCachePtr->varName0; @@ -4291,9 +4297,9 @@ static void GetVarAndNameFromHash(Tcl_HashEntry *hPtr, Var **val, Tcl_Obj **varNameObj) { - assert(hPtr != NULL); - assert(val != NULL); - assert(varNameObj != NULL); + nonnull_assert(hPtr != NULL); + nonnull_assert(val != NULL); + nonnull_assert(varNameObj != NULL); *val = TclVarHashGetValue(hPtr); *varNameObj = TclVarHashGetKey(*val); @@ -4328,7 +4334,7 @@ MethodName(Tcl_Obj *methodObj) { const char *methodName; - assert(methodObj != NULL); + nonnull_assert(methodObj != NULL); methodName = ObjStr(methodObj); if (FOR_COLON_RESOLVER(methodName)) { @@ -4340,7 +4346,7 @@ const char * NsfMethodName(Tcl_Obj *methodObj) { - assert(methodObj != NULL); + nonnull_assert(methodObj != NULL); return MethodName(methodObj); } @@ -4368,8 +4374,8 @@ Tcl_Obj *resultObj = Tcl_NewListObj(0, NULL); - assert(interp != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); if (framePtr != NULL) { Tcl_ListObjAppendList(interp, resultObj, @@ -4410,9 +4416,9 @@ int new, frameFlags; Tcl_Obj *key; - assert(interp != NULL); - assert(varName != NULL); - assert(varPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(varName != NULL); + nonnull_assert(varPtr != NULL); #if defined (VAR_RESOLVER_TRACE) fprintf(stderr, "NsColonVarResolver '%s' flags %.6x\n", varName, flags); @@ -4605,8 +4611,8 @@ Tcl_Var var; int new; - assert(interp != NULL); - assert(vinfoPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(vinfoPtr != NULL); resVarInfo = (NsfResolvedVarInfo *)vinfoPtr; var = resVarInfo->var; @@ -4712,7 +4718,7 @@ CompiledColonVarFree(Tcl_ResolvedVarInfo *vInfoPtr) { NsfResolvedVarInfo *resVarInfo; - assert(vInfoPtr != NULL); + nonnull_assert(vInfoPtr != NULL); resVarInfo = (NsfResolvedVarInfo *)vInfoPtr; #if defined(VAR_RESOLVER_TRACE) @@ -4770,9 +4776,9 @@ */ NsfObject *object = GetSelfObj(interp); - assert(interp != NULL); - assert(name != NULL); - assert(rPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); + nonnull_assert(rPtr != NULL); #if defined(VAR_RESOLVER_TRACE) fprintf(stderr, "compiled var resolver for %s, obj %p\n", name, object); @@ -4824,8 +4830,8 @@ InterpGetFrameAndFlags(Tcl_Interp *interp, CallFrame **framePtr) { int frameFlags; - assert(interp != NULL); - assert(framePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(framePtr != NULL); *framePtr = Tcl_Interp_varFramePtr(interp); frameFlags = Tcl_CallFrame_isProcCallFrame(*framePtr); @@ -4889,9 +4895,9 @@ Tcl_Obj *keyObj; Tcl_Var var; - assert(interp != NULL); - assert(varName != NULL); - assert(varPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(varName != NULL); + nonnull_assert(varPtr != NULL); /* * TCL_GLOBAL_ONLY is removed, since "vwait :varName" is called with @@ -5051,9 +5057,9 @@ CallFrame *varFramePtr; int frameFlags; - assert(interp != NULL); - assert(cmdName != NULL); - assert(cmdPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(cmdPtr != NULL); /* fprintf(stderr, "InterpColonCmdResolver %s flags %.6x\n", cmdName, flags); */ @@ -5183,7 +5189,7 @@ static void NsfNamespaceInit(Tcl_Namespace *nsPtr) { - assert(nsPtr != NULL); + nonnull_assert(nsPtr != NULL); /* * This puts a per-object namespace resolver into position upon @@ -5224,14 +5230,14 @@ #ifdef NSF_MEM_COUNT NsfNamespaceClientData *nsClientData = (NsfNamespaceClientData *)clientData; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); /*fprintf(stderr, "NSNamespaceDeleteProc cd %p\n", clientData); fprintf(stderr, "... nsPtr %p name '%s'\n", nsClientData->nsPtr, nsClientData->nsPtr->fullName);*/ return nsClientData->object; #else - assert(clientData != NULL); + nonnull_assert(clientData != NULL); return (NsfObject *) clientData; #endif } @@ -5264,9 +5270,9 @@ SlotContainerCmdResolver(Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, unsigned int flags, Tcl_Command *cmdPtr) { - assert(cmdName != NULL); - assert(nsPtr != NULL); - assert(cmdPtr != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(cmdPtr != NULL); if (*cmdName == ':' || ((flags & TCL_GLOBAL_ONLY) != 0u)) { /* colon names (InterpColonCmdResolver) and global lookups are not for us */ @@ -5322,14 +5328,14 @@ static Tcl_Namespace * RequireObjNamespace(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->nsPtr == NULL) { MakeObjNamespace(interp, object); NsfNamespaceInit(object->nsPtr); } - assert(object->nsPtr); + assert(object->nsPtr != NULL); return object->nsPtr; } @@ -5354,7 +5360,7 @@ static void NSNamespacePreserve(Tcl_Namespace *nsPtr) { - assert(nsPtr != NULL); + nonnull_assert(nsPtr != NULL); MEM_COUNT_ALLOC("NSNamespace", nsPtr); Tcl_Namespace_refCount(nsPtr)++; @@ -5376,7 +5382,7 @@ static void NSNamespaceRelease(Tcl_Namespace *nsPtr) { - assert(nsPtr != NULL); + nonnull_assert(nsPtr != NULL); MEM_COUNT_FREE("NSNamespace", nsPtr); Tcl_Namespace_refCount(nsPtr)--; @@ -5413,9 +5419,9 @@ NSDeleteCmd(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *methodName) { Tcl_Command token; - assert(interp != NULL); - assert(nsPtr != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(methodName != NULL); if ((token = FindMethod(nsPtr, methodName))) { return Tcl_DeleteCommandFromToken(interp, token); @@ -5445,8 +5451,8 @@ static int NSDeleteChild(Tcl_Interp *interp, Tcl_Command cmd, int deleteObjectsOnly) { - assert(cmd != NULL); - assert(interp != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, "NSDeleteChildren child %p flags %.6x epoch %d\n", (void *)cmd, Tcl_Command_flags(cmd), Tcl_Command_cmdEpoch(cmd));*/ @@ -5549,8 +5555,8 @@ Tcl_HashEntry *hPtr; int expected; - assert(interp != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); #ifdef OBJDELETION_TRACE fprintf(stderr, "NSDeleteChildren %p %s activationCount %d\n", @@ -5617,8 +5623,8 @@ Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; - assert(interp != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); #ifdef OBJDELETION_TRACE fprintf(stderr, "NSCleanupNamespace %p flags %.6x\n", nsPtr, Tcl_Namespace_flags(nsPtr)); @@ -5661,16 +5667,17 @@ static void NSNamespaceDeleteProc(ClientData clientData) { - NsfObject *object = NSNamespaceClientDataObject(clientData); + NsfObject *object; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); + object = NSNamespaceClientDataObject(clientData); + assert(object != NULL); + #ifdef NSF_MEM_COUNT ckfree((char *)clientData); #endif - assert(object != NULL); - /*fprintf(stderr, "namespace delete-proc obj=%p ns=%p\n", clientData, (object != NULL) ? object->nsPtr : NULL);*/ @@ -5685,8 +5692,8 @@ int activationCount = 0; Tcl_CallFrame *f = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); - assert(interp != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); /*fprintf(stderr, "Nsf_DeleteNamespace %p ", nsPtr);*/ @@ -5734,7 +5741,7 @@ NSValidObjectName(const char *name, size_t l) { register const char *n; - assert(name != NULL); + nonnull_assert(name != NULL); n = name; if (*n == '\0') { @@ -5778,9 +5785,9 @@ Namespace *dummy1Ptr, *dummy2Ptr, *nsPtr; const char *dummy; - assert(interp != NULL); - assert(object != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(name != NULL); TclGetNamespaceForQualName(interp, name, NULL, TCL_FIND_ONLY_NS|TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy); @@ -5839,8 +5846,8 @@ NSRequireParentObject(Tcl_Interp *interp, const char *parentName) { int result; - assert(interp != NULL); - assert(parentName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(parentName != NULL); result = NsfCallObjectUnknownHandler(interp, Tcl_NewStringObj(parentName, -1)); @@ -5892,8 +5899,8 @@ Tcl_DString ds, *dsPtr = &ds; int parentNameLength; - assert(interp != NULL); - assert(nameString != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameString != NULL); /*fprintf(stderr, "NSCheckNamespace %s parentNsPtr %p\n", nameString, parentNsPtr);*/ @@ -5998,8 +6005,8 @@ NSFindCommand(Tcl_Interp *interp, const char *name) { Tcl_Command cmd; - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); assert(*name == ':' && *(name + 1) == ':'); cmd = Tcl_FindCommand(interp, name, NULL, TCL_GLOBAL_ONLY); @@ -6039,8 +6046,8 @@ Tcl_HashSearch search; Tcl_HashEntry *hPtr; - assert(searchCmdPtr != NULL); - assert(cmdTablePtr != NULL); + nonnull_assert(searchCmdPtr != NULL); + nonnull_assert(cmdTablePtr != NULL); for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); hPtr != NULL; @@ -6080,7 +6087,7 @@ NsfObject *screenedObject; int found; - assert(cmdPtr != NULL); + nonnull_assert(cmdPtr != NULL); /* * We can provide a shortcut, knowing that a) exposed cmds have an epoch @@ -6138,8 +6145,8 @@ GetObjectFromString(Tcl_Interp *interp, const char *name) { register Tcl_Command cmd; - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); /*fprintf(stderr, "GetObjectFromString name = '%s'\n", name);*/ cmd = NSFindCommand(interp, name); @@ -6171,8 +6178,8 @@ GetClassFromString(Tcl_Interp *interp, const char *name) { NsfObject *object = GetObjectFromString(interp, name); - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); return (object != NULL && NsfObjectIsClass(object)) ? (NsfClass *)object : NULL; } @@ -6199,10 +6206,10 @@ int result, ok; Tcl_Command cmd; - assert(interp != NULL); - assert(nsPtr != NULL); - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); cmd = FindMethod(nsPtr, methodName); @@ -6272,10 +6279,10 @@ Tcl_Command newCmd; int result; - assert(interp != NULL); - assert(object1 != NULL); - assert(methodName != NULL); - assert(proc != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object1 != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(proc != NULL); object = (NsfObject *)object1; ns = RequireObjNamespace(interp, object); @@ -6331,10 +6338,10 @@ NsfClass *cl; int result; - assert(interp != NULL); - assert(class != NULL); - assert(methodName != NULL); - assert(proc != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(proc != NULL); cl = (NsfClass *)class; assert(cl->nsPtr != NULL); @@ -6376,9 +6383,9 @@ CallFrame frame, *framePtr = &frame; int flogs = TCL_LEAVE_ERR_MSG; - assert(interp != NULL); - assert(nameObj != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(object != NULL); Nsf_PushFrameObj(interp, object, framePtr); if (object->nsPtr != NULL) { @@ -6498,8 +6505,8 @@ CallStackDoDestroy(Tcl_Interp *interp, NsfObject *object) { Tcl_Command oid; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "CallStackDoDestroy %p flags %.6x\n", object, object->flags);*/ PRINTOBJ("CallStackDoDestroy", object); @@ -6550,8 +6557,8 @@ static void CallStackDestroyObject(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #ifdef OBJDELETION_TRACE fprintf(stderr, "CallStackDestroyObject %p %s activationcount %d flags %.6x\n", @@ -6626,8 +6633,8 @@ CmdListAdd(NsfCmdList **cList, Tcl_Command cmd, NsfClass *clorobj, int noDuplicates, int atEnd) { NsfCmdList *l, *nextPtr, *new; - assert(cmd != NULL); - assert(cList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cList != NULL); if (unlikely(atEnd)) { l = *cList; @@ -6709,8 +6716,8 @@ CmdListAddSorted(NsfCmdList **cList, Tcl_Command cmd, NsfClass *clorobj) { NsfCmdList *prev, *new, *h; - assert(cmd != NULL); - assert(cList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cList != NULL); for (h = *cList, prev = NULL; h; prev = h, h = h->nextPtr) { if (h->cmdPtr == cmd) { @@ -6743,8 +6750,8 @@ CmdListReplaceCmd(NsfCmdList *replace, Tcl_Command cmd, NsfClass *clorobj) { Tcl_Command del; - assert(replace != NULL); - assert(clorobj != NULL); + nonnull_assert(replace != NULL); + nonnull_assert(clorobj != NULL); del = replace->cmdPtr; replace->cmdPtr = cmd; @@ -6761,8 +6768,8 @@ static void CmdListPrint(Tcl_Interp *interp, const char *title, NsfCmdList *cmdList) { - assert(interp != NULL); - assert(cmdList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdList != NULL); if (title != NULL) { fprintf(stderr, "%s %p:\n", title, cmdList); @@ -6787,7 +6794,7 @@ static void CmdListDeleteCmdListEntry(NsfCmdList *del, NsfFreeCmdListClientData *freeFct) { - assert(del != NULL); + nonnull_assert(del != NULL); if (unlikely(freeFct != NULL)) { (*freeFct)(del); @@ -6808,8 +6815,8 @@ register NsfCmdList *c; NsfCmdList *del = NULL; - assert(cmdList != NULL); - assert(delCL != NULL); + nonnull_assert(cmdList != NULL); + nonnull_assert(delCL != NULL); c = *cmdList; if (c == NULL) { @@ -6855,8 +6862,8 @@ CmdListRemoveDeleted(NsfCmdList **cmdList, NsfFreeCmdListClientData *freeFct) { NsfCmdList *f, *del; - assert(cmdList != NULL); - assert(freeFct != NULL); + nonnull_assert(cmdList != NULL); + nonnull_assert(freeFct != NULL); f = *cmdList; while (f) { @@ -6890,9 +6897,9 @@ NsfFreeCmdListClientData *freeFct) { NsfCmdList *c, *del = NULL; - assert(cmdList != NULL); - assert(clorobj != NULL); - assert(freeFct != NULL); + nonnull_assert(cmdList != NULL); + nonnull_assert(clorobj != NULL); + nonnull_assert(freeFct != NULL); /* CmdListRemoveDeleted(cmdList, freeFct); @@ -6927,7 +6934,7 @@ static void CmdListFree(NsfCmdList **cmdList, NsfFreeCmdListClientData *freeFct) { - assert(cmdList != NULL); + nonnull_assert(cmdList != NULL); while (*cmdList) { NsfCmdList *del = *cmdList; @@ -6946,8 +6953,8 @@ CmdListFindCmdInList(Tcl_Command cmd, NsfCmdList *l) { register NsfCmdList *h; - assert(cmd != NULL); - assert(l); + nonnull_assert(cmd != NULL); + nonnull_assert(l != NULL); for (h = l; h; h = h->nextPtr) { if (h->cmdPtr == cmd) { @@ -6967,9 +6974,9 @@ static NsfCmdList * CmdListFindNameInList(Tcl_Interp *interp, const char *name, NsfCmdList *cmdList) { - assert(interp != NULL); - assert(name != NULL); - assert(cmdList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); + nonnull_assert(cmdList != NULL); do { const char *cmdName = Tcl_GetCommandName(interp, cmdList->cmdPtr); @@ -7004,8 +7011,8 @@ int result, success; Tcl_Obj *ov[2] = {NULL, condition}; - assert(interp != NULL); - assert(condition != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(condition != NULL); INCR_REF_COUNT(condition); result = Nsf_ExprObjCmd(NULL, interp, 2, ov); @@ -7043,7 +7050,7 @@ static void TclObjListFreeList(NsfTclObjList *list) { - assert(list != NULL); + nonnull_assert(list != NULL); do { NsfTclObjList *del = list; @@ -7079,8 +7086,8 @@ TclObjListNewElement(NsfTclObjList **list, Tcl_Obj *obj, Tcl_Obj *valueObj) { NsfTclObjList *elt = NEW(NsfTclObjList); - assert(list != NULL); - assert(obj != NULL); + nonnull_assert(list != NULL); + nonnull_assert(obj != NULL); INCR_REF_COUNT2("listContent", obj); elt->content = obj; @@ -7118,10 +7125,10 @@ NsfTclObjList *elt, **prevPtr; const char *keyString = ObjStr(key); - assert(interp != NULL); - assert(list != NULL); - assert(key != NULL); - assert(value != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(list != NULL); + nonnull_assert(key != NULL); + nonnull_assert(value != NULL); for (elt = *list, prevPtr = list; elt; prevPtr = &elt->nextPtr, elt = elt->nextPtr) { const char *eltString = ObjStr(elt->content); @@ -7166,7 +7173,7 @@ Tcl_Obj **ov; int oc; NsfTclObjList *last = NULL; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (aObj && Tcl_ListObjGetElements(interp, aObj, &oc, &ov) == TCL_OK) { if (oc > 0) { @@ -7185,7 +7192,7 @@ AssertionList(Tcl_Interp *interp, NsfTclObjList *alist) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); - assert(interp != NULL); + nonnull_assert(interp != NULL); for (; alist; alist = alist->nextPtr) { Tcl_ListObjAppendElement(interp, listObj, alist->content); @@ -7200,8 +7207,8 @@ NsfObjectOpt *opt = object->opt; Tcl_Obj *resultObj; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (opt == 0) { return TCL_OK; @@ -7232,8 +7239,8 @@ AssertionFindProcs(NsfAssertionStore *aStore, const char *name) { Tcl_HashEntry *hPtr; - assert(aStore != NULL); - assert(name != NULL); + nonnull_assert(aStore != NULL); + nonnull_assert(name != NULL); hPtr = Tcl_CreateHashEntry(&aStore->procs, name, NULL); if (hPtr == NULL) { @@ -7248,8 +7255,8 @@ AssertionRemoveProc(NsfAssertionStore *aStore, const char *name) { Tcl_HashEntry *hPtr; - assert(aStore != NULL); - assert(name != NULL); + nonnull_assert(aStore != NULL); + nonnull_assert(name != NULL); hPtr = Tcl_CreateHashEntry(&aStore->procs, name, NULL); if (hPtr != NULL) { @@ -7276,9 +7283,9 @@ Tcl_HashEntry *hPtr = NULL; NsfProcAssertion *procs = NEW(NsfProcAssertion); - assert(interp != NULL); - assert(name != NULL); - assert(aStore != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); + nonnull_assert(aStore != NULL); AssertionRemoveProc(aStore, name); procs->pre = AssertionNewList(interp, pre); @@ -7308,7 +7315,7 @@ Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; - assert(aStore != NULL); + nonnull_assert(aStore != NULL); for (hPtr = Tcl_FirstHashEntry(&aStore->procs, &hSrch); hPtr; hPtr = Tcl_FirstHashEntry(&aStore->procs, &hSrch)) { @@ -7337,9 +7344,9 @@ Tcl_Obj *savedResultObj = Tcl_GetObjResult(interp); int savedCheckoptions, acResult = TCL_OK; - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); /* * no obj->opt -> checkoption == CHECK_NONE @@ -7436,9 +7443,9 @@ CheckOptions checkoptions) { int result = TCL_OK; - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); if (checkoptions & CHECK_OBJINVAR && object->opt->assertions) { result = AssertionCheckList(interp, object, object->opt->assertions->invariants, @@ -7471,10 +7478,10 @@ int result = TCL_OK; NsfAssertionStore *aStore; - assert(interp != NULL); - assert(object != NULL); - assert(method != NULL); - assert(object->opt); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(method != NULL); + assert(object->opt != NULL); if (cl != NULL) { aStore = (cl->opt != NULL) ? cl->opt->assertions : NULL; @@ -7511,9 +7518,9 @@ int ocArgs; Tcl_Obj **ovArgs; - assert(interp != NULL); - assert(object != NULL); - assert(arg != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(arg != NULL); opt->checkoptions = CHECK_NONE; @@ -7564,9 +7571,9 @@ static void AssertionSetInvariants(Tcl_Interp *interp, NsfAssertionStore **assertions, Tcl_Obj *arg) { - assert(interp != NULL); - assert(assertions != NULL); - assert(arg != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(assertions != NULL); + nonnull_assert(arg != NULL); if (*assertions) { TclObjListFreeList((*assertions)->invariants); @@ -7593,7 +7600,7 @@ MixinStackPush(NsfObject *object) { register NsfMixinStack *h = NEW(NsfMixinStack); - assert(object != NULL); + nonnull_assert(object != NULL); h->currentCmdPtr = NULL; h->nextPtr = object->mixinStack; @@ -7611,7 +7618,7 @@ MixinStackPop(NsfObject *object) { register NsfMixinStack *h; - assert(object != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "MixinStackPop %p %s\n", object, ObjectName(object));*/ h = object->mixinStack; @@ -7634,10 +7641,10 @@ NsfCmdList *m; NsfClasses *pl, **clPtr = mixinClasses; - assert(interp != NULL); - assert(mixinList != NULL); - assert(mixinClasses != NULL); - assert(checkList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(mixinList != NULL); + nonnull_assert(mixinClasses != NULL); + nonnull_assert(checkList != NULL); CmdListRemoveDeleted(mixinList, GuardDel); @@ -7698,7 +7705,7 @@ static void MixinResetOrder(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); CmdListFree(&object->mixinOrder, NULL /*GuardDel*/); object->mixinOrder = NULL; @@ -7728,10 +7735,10 @@ NsfClasses **classListPtr, NsfClasses **checkList) { NsfClasses *pl; - assert(interp != NULL); - assert(cl != NULL); - assert(classListPtr != NULL); - assert(checkList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(classListPtr != NULL); + nonnull_assert(checkList != NULL); for (pl = PrecedenceOrder(cl); pl; pl = pl->nextPtr) { NsfClassOpt *clopt = pl->cl->opt; @@ -7764,8 +7771,8 @@ MixinComputeOrder(Tcl_Interp *interp, NsfObject *object) { NsfClasses *fullList, *checkList = NULL, *mixinClasses = NULL, *clPtr; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->mixinOrder != NULL) { MixinResetOrder(object); @@ -7886,10 +7893,10 @@ Tcl_Obj *guardObj; NsfCmdList *new; - assert(interp != NULL); - assert(mixinList != NULL); - assert(nameObj != NULL); - assert(baseClass != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(mixinList != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(baseClass != NULL); /*fprintf(stderr, "MixinAdd gets obj %p type %p %s\n", nameObj, nameObj->typePtr, (nameObj->typePtr != NULL) ?nameObj->typePtr->name : "NULL");*/ @@ -7939,9 +7946,9 @@ static void AppendMatchingElement(Tcl_Interp *interp, Tcl_Obj *resultObj, Tcl_Obj *nameObj, const char *pattern) { - assert(interp != NULL); - assert(resultObj != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(resultObj != NULL); + nonnull_assert(nameObj != NULL); if (pattern == NULL || Tcl_StringMatch( ObjStr(nameObj), pattern)) { Tcl_ListObjAppendElement(interp, resultObj, nameObj); @@ -7974,9 +7981,9 @@ const char *pattern, NsfObject *matchObject) { int rc = 0; - assert(interp != NULL); - assert(cmdList != NULL); - assert(resultObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdList != NULL); + nonnull_assert(resultObj != NULL); do { NsfObject *object = NsfGetObjectFromCmdPtr(cmdList->cmdPtr); @@ -8017,7 +8024,7 @@ const char *pattern, NsfObject *matchObject) { Tcl_Obj *resultObj; - assert(interp != NULL); + nonnull_assert(interp != NULL); resultObj = Tcl_GetObjResult(interp); for ( ; cls != NULL; cls = cls->nextPtr) { @@ -8057,9 +8064,9 @@ GetAllInstances(Tcl_Interp *interp, NsfCmdList **instances, NsfClass *startCl) { NsfClasses *clPtr, *subClasses = TransitiveSubClasses(startCl); - assert(interp != NULL); - assert(instances != NULL); - assert(startCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(instances != NULL); + nonnull_assert(startCl != NULL); for (clPtr = subClasses; clPtr; clPtr = clPtr->nextPtr) { Tcl_HashTable *tablePtr = &clPtr->cl->instances; @@ -8145,11 +8152,11 @@ Tcl_Obj *resultSet, NsfObject *object, int *new, int appendResult, const char *pattern, NsfObject *matchObject) { - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(resultSet != NULL); - assert(object != NULL); - assert(new != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(resultSet != NULL); + nonnull_assert(object != NULL); + nonnull_assert(new != NULL); Tcl_CreateHashEntry(destTablePtr, (char *)object, new); if (*new) { @@ -8191,12 +8198,12 @@ ClientData clientData, int *new, int appendResult, const char *pattern, NsfObject *matchObject) { - assert(clientData != NULL); - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(cl != NULL); - assert(resultSet != NULL); - assert(new != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(resultSet != NULL); + nonnull_assert(new != NULL); Tcl_CreateHashEntry(destTablePtr, (char *)cl, new); if (*new) { @@ -8250,10 +8257,10 @@ int rc = 0, new = 0; NsfClasses *sc; - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(resultSet != NULL); - assert(startCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(resultSet != NULL); + nonnull_assert(startCl != NULL); /*fprintf(stderr, "startCl = %s, opt %p, isMixin %d, pattern '%s', matchObject %p\n", ClassName(startCl), startCl->opt, isMixin, pattern, matchObject);*/ @@ -8348,10 +8355,10 @@ const char *pattern, NsfObject *matchObject) { NsfCmdList *m; - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(resultSet != NULL); - assert(mixinOfs != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(resultSet != NULL); + nonnull_assert(mixinOfs != NULL); for (m = mixinOfs; m; m = m->nextPtr) { NsfClass *cl; @@ -8404,10 +8411,10 @@ int rc = 0, new = 0; NsfClasses *sc; - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(resultSet != NULL); - assert(startCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(resultSet != NULL); + nonnull_assert(startCl != NULL); /*fprintf(stderr, "GetAllClassMixinsOf startCl = %p %s, opt %p, isPCM %d\n", startCl, ClassName(startCl), startCl->opt, isPCM);*/ @@ -8518,10 +8525,10 @@ NsfClass *cl; NsfClasses *sc; - assert(interp != NULL); - assert(destTablePtr != NULL); - assert(resultObj != NULL); - assert(startCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(destTablePtr != NULL); + nonnull_assert(resultObj != NULL); + nonnull_assert(startCl != NULL); /* * check this class for class mixins. @@ -8599,8 +8606,8 @@ static void RemoveFromClassMixinsOf(Tcl_Command cmd, NsfCmdList *cmdList) { - assert(cmd != NULL); - assert(cmdList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cmdList != NULL); do { NsfClass *ncl = NsfGetClassFromCmdPtr(cmdList->cmdPtr); @@ -8639,10 +8646,10 @@ static void RemoveFromObjectMixinsOf(Tcl_Command cmd, NsfCmdList *cmdList) { - assert(cmd != NULL); - assert(cmdList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cmdList != NULL); - for ( ; likely(cmdList != NULL); cmdList = cmdList->nextPtr) { + do { NsfClass *cl = NsfGetClassFromCmdPtr(cmdList->cmdPtr); NsfClassOpt *clopt = (cl != NULL) ? cl->opt : NULL; if (clopt != NULL) { @@ -8654,7 +8661,8 @@ CmdListDeleteCmdListEntry(del, GuardDel); } } /* else fprintf(stderr, "CleanupDestroyObject %s: NULL pointer in mixins!\n", ObjectName(object)); */ - } + cmdList = cmdList->nextPtr; + } while(likely(cmdList != NULL)); } /* @@ -8678,10 +8686,10 @@ static void RemoveFromClassmixins(Tcl_Command cmd, NsfCmdList *cmdList) { - assert(cmd != NULL); - assert(cmdList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cmdList != NULL); - for ( ; likely(cmdList != NULL); cmdList = cmdList->nextPtr) { + do { NsfClass *cl = NsfGetClassFromCmdPtr(cmdList->cmdPtr); NsfClassOpt *clopt = (cl != NULL) ? cl->opt : NULL; @@ -8698,7 +8706,8 @@ } } } - } + cmdList = cmdList->nextPtr; + } while (likely(cmdList != NULL)); } /* @@ -8721,10 +8730,10 @@ static void RemoveFromObjectMixins(Tcl_Command cmd, NsfCmdList *cmdList) { - assert(cmd != NULL); - assert(cmdList != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cmdList != NULL); - for ( ; likely(cmdList != NULL); cmdList = cmdList->nextPtr) { + do { NsfObject *nobj = NsfGetObjectFromCmdPtr(cmdList->cmdPtr); NsfObjectOpt *objopt = (nobj != 0) ? nobj->opt : NULL; @@ -8741,7 +8750,8 @@ } } } - } + cmdList = cmdList->nextPtr; + } while (likely(cmdList != NULL)); } @@ -8768,7 +8778,7 @@ /*fprintf(stderr, "ResetOrderOfObjectsUsingThisClassAsObjectMixin %s - %p\n", ClassName(cl), cl->opt);*/ - assert(cl != NULL); + nonnull_assert(cl != NULL); if (cl->opt != NULL) { NsfCmdList *ml; @@ -8810,9 +8820,9 @@ static void MixinInvalidateObjOrders(Tcl_Interp *interp, NsfClass *cl, NsfClasses *subClasses) { - assert(interp != NULL); - assert(cl != NULL); - assert(subClasses != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(subClasses != NULL); /* * Iterate over the subclass hierarchy. @@ -8875,8 +8885,8 @@ static void MixinComputeDefined(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); MixinComputeOrder(interp, object); object->flags |= NSF_MIXIN_ORDER_VALID; @@ -8915,8 +8925,8 @@ int withMixins, int withRootClass) { NsfClasses *precedenceList = NULL, *pcl, **npl = &precedenceList; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (withMixins != 0) { if ((object->flags & NSF_MIXIN_ORDER_VALID) == 0u) { @@ -8970,7 +8980,7 @@ static NsfCmdList * SeekCurrent(Tcl_Command cmd, register NsfCmdList *cmdListPtr) { - assert(cmdListPtr != NULL); + nonnull_assert(cmdListPtr != NULL); if (cmd != NULL) { for (; likely(cmdListPtr != NULL); cmdListPtr = cmdListPtr->nextPtr) { @@ -9006,9 +9016,9 @@ int result = TCL_OK; int cmdFlags = Tcl_Command_flags(cmd); - assert(interp != NULL); - assert(object != NULL); - assert(cmdList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cmdList != NULL); if ((cmdFlags & NSF_CMD_CALL_PRIVATE_METHOD) || ((cmdFlags & NSF_CMD_CLASS_ONLY_METHOD) && !NsfObjectIsClass(object))) { @@ -9062,13 +9072,14 @@ NsfClass *cl = NULL; int result = TCL_OK; - assert(interp != NULL); - assert(object != NULL); - assert(object->mixinStack); - assert(methodName != NULL); - assert(clPtr != NULL); - assert(currentCmdPtr != NULL); - assert(cmdPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(clPtr != NULL); + nonnull_assert(currentCmdPtr != NULL); + nonnull_assert(cmdPtr != NULL); + + assert(object->mixinStack != NULL); /* ensure that the mixin order is valid */ assert((object->flags & NSF_MIXIN_ORDER_VALID) != 0u); @@ -9200,7 +9211,7 @@ int withGuards, NsfObject *matchObject) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); - assert(interp != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, " mixin info m=%p, pattern %s, matchObject %p\n", m, pattern, matchObject);*/ @@ -9247,9 +9258,9 @@ MixinSearchMethodByName(NsfCmdList *mixinList, const char *name, NsfClass **clPtr) { Tcl_Command cmd; - assert(mixinList != NULL); - assert(name != NULL); - assert(clPtr != NULL); + nonnull_assert(mixinList != NULL); + nonnull_assert(name != NULL); + nonnull_assert(clPtr != NULL); for (; likely(mixinList != NULL); mixinList = mixinList->nextPtr) { NsfClass *foundCl = NsfGetClassFromCmdPtr(mixinList->cmdPtr); @@ -9284,8 +9295,8 @@ NsfClass *startingClass, NsfClass **clPtr) { Tcl_Command cmd = NULL; - assert(name != NULL); - assert(clPtr != NULL); + nonnull_assert(name != NULL); + nonnull_assert(clPtr != NULL); if (startingObject != NULL) { NsfObjectOpt *opt = startingObject->opt; @@ -9356,8 +9367,8 @@ NsfRuntimeState *rst = RUNTIME_STATE(interp); int result; - assert(interp != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(guardObj != NULL); /* * if there are more than one filter guard for this filter @@ -9407,7 +9418,7 @@ static void GuardDel(NsfCmdList *guardList) { - assert(guardList != NULL); + nonnull_assert(guardList != NULL); /*fprintf(stderr, "GuardDel %p clientData = %p\n", guardList, (guardList != NULL) ? guardList->clientData : NULL);*/ @@ -9421,8 +9432,8 @@ NSF_INLINE static void GuardAdd(NsfCmdList *guardList, Tcl_Obj *guardObj) { - assert(guardList != NULL); - assert(guardObj != NULL); + nonnull_assert(guardList != NULL); + nonnull_assert(guardObj != NULL); GuardDel(guardList); if (strlen(ObjStr(guardObj)) > 0) { @@ -9440,9 +9451,9 @@ Tcl_Obj *res = Tcl_GetObjResult(interp); /* save the result */ CallFrame frame, *framePtr = &frame; - assert(object != NULL); - assert(interp != NULL); - assert(guardObj != NULL); + nonnull_assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(guardObj != NULL); INCR_REF_COUNT(res); @@ -9499,9 +9510,9 @@ NsfCmdList *interceptorDefList) { NsfCmdList *h; - assert(interceptorCmd != NULL); - assert(dest != NULL); - assert(interceptorDefList != NULL); + nonnull_assert(interceptorCmd != NULL); + nonnull_assert(dest != NULL); + nonnull_assert(interceptorDefList != NULL); h = CmdListFindCmdInList(interceptorCmd, interceptorDefList); if (h != NULL) { @@ -9539,10 +9550,10 @@ int guardAdded = 0; NsfObjectOpt *opt; - assert(filterCmd != NULL); - assert(interp != NULL); - assert(dest != NULL); - assert(object != NULL); + nonnull_assert(filterCmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(dest != NULL); + nonnull_assert(object != NULL); /* search guards for class filters registered on mixins */ if (((object->flags & NSF_MIXIN_ORDER_VALID)) == 0u) { @@ -9616,8 +9627,8 @@ static int GuardList(Tcl_Interp *interp, NsfCmdList *guardList, const char *interceptorName) { - assert(interp != NULL); - assert(interceptorName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(interceptorName != NULL); if (guardList != NULL) { /* try to find simple name first */ @@ -9666,8 +9677,8 @@ Tcl_HashEntry *hPtr; int newItem; - assert(interp != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); hPtr = Tcl_CreateHashEntry(&rst->activeFilterTablePtr, methodName, &newItem); if (newItem != 0) { @@ -9700,8 +9711,8 @@ NsfRuntimeState *rst = RUNTIME_STATE(interp); Tcl_HashEntry *hPtr; - assert(interp != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); hPtr = Tcl_CreateHashEntry(&rst->activeFilterTablePtr, methodName, NULL); return (hPtr != NULL); @@ -9727,7 +9738,7 @@ FiltersDefined(Tcl_Interp *interp) { NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); return Tcl_HashSize(&rst->activeFilterTablePtr); } @@ -9760,9 +9771,9 @@ NsfCmdList *new; NsfClass *cl; - assert(interp != NULL); - assert(filterList != NULL); - assert(filterregObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(filterList != NULL); + nonnull_assert(filterregObj != NULL); /* * When the provided nameObj is of type NsfFilterregObjType, the nsf specific @@ -9823,7 +9834,7 @@ static void FilterResetOrder(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); CmdListFree(&object->filterOrder, GuardDel); object->filterOrder = NULL; @@ -9854,8 +9865,8 @@ NsfObject *startingObject, NsfClass *startingClass) { NsfCmdList *cmdList, *del; - assert(interp != NULL); - assert(filters != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(filters != NULL); CmdListRemoveDeleted(filters, GuardDel); for (cmdList = *filters; cmdList; cmdList = cmdList->nextPtr) { @@ -9901,8 +9912,8 @@ static void FilterInvalidateObjOrders(Tcl_Interp *interp, NsfClasses *subClasses) { - assert(interp != NULL); - assert(subClasses != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(subClasses != NULL); do { Tcl_HashSearch hSrch; @@ -9957,8 +9968,8 @@ static void FilterRemoveDependentFilterCmds(NsfClass *removeClass, NsfClasses *subClasses) { - assert(removeClass != NULL); - assert(subClasses != NULL); + nonnull_assert(removeClass != NULL); + nonnull_assert(subClasses != NULL); /*fprintf(stderr, "FilterRemoveDependentFilterCmds removeClass %p %s\n", removeClass, ObjStr(removeClass->object.cmdName));*/ @@ -10006,8 +10017,8 @@ MethodHandleObj(NsfObject *object, int withPer_object, const char *methodName) { Tcl_Obj *resultObj; - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); assert(*methodName != ':'); resultObj = Tcl_NewStringObj((withPer_object == 1) ? "" : "::nsf::classes", -1); @@ -10041,7 +10052,7 @@ int withGuards, int withMethodHandles) { Tcl_Obj *list = Tcl_NewListObj(0, NULL); - assert(interp != NULL); + nonnull_assert(interp != NULL); /* * Guard lists should only have unqualified filter lists when withGuards is @@ -10108,9 +10119,9 @@ NsfClass *fcl; NsfClasses *pl; - assert(interp != NULL); - assert(filters != NULL); - assert(filterList != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(filters != NULL); + nonnull_assert(filterList != NULL); /* * Ensure that no epoched command is in the filters list. @@ -10173,8 +10184,8 @@ NsfCmdList *filterList = NULL, *next, *checker, *newList; NsfClasses *pl; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->filterOrder != NULL) { FilterResetOrder(object); @@ -10274,8 +10285,8 @@ static void FilterComputeDefined(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); FilterComputeOrder(interp, object); object->flags |= NSF_FILTER_ORDER_VALID; @@ -10307,8 +10318,8 @@ FilterStackPush(NsfObject *object, Tcl_Obj *calledProc) { register NsfFilterStack *h = NEW(NsfFilterStack); - assert(object != NULL); - assert(calledProc != NULL); + nonnull_assert(object != NULL); + nonnull_assert(calledProc != NULL); h->currentCmdPtr = NULL; h->calledProc = calledProc; @@ -10337,7 +10348,7 @@ FilterStackPop(NsfObject *object) { register NsfFilterStack *h; - assert(object != NULL); + nonnull_assert(object != NULL); h = object->filterStack; object->filterStack = h->nextPtr; @@ -10372,9 +10383,9 @@ Tcl_Obj *list = Tcl_NewListObj(0, NULL); NsfClasses *pl; - assert(interp != NULL); - assert(object != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cmd != NULL); /* search per-object filters */ if (object->opt != NULL @@ -10430,12 +10441,12 @@ FilterSearchProc(Tcl_Interp *interp, NsfObject *object, Tcl_Command *currentCmd, NsfClass **clPtr) { - assert(interp != NULL); - assert(object != NULL); - assert(object->filterStack); - assert(currentCmd != NULL); - assert(clPtr != NULL); - + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(currentCmd != NULL); + nonnull_assert(clPtr != NULL); + + assert(object->filterStack != NULL); /* * Ensure that the filter order is not invalid, otherwise compute order * FilterComputeDefined(interp, object); @@ -10503,10 +10514,10 @@ NsfClass **scl; int i, j; - assert(interp != NULL); - assert(cl != NULL); - assert(ov != NULL); - assert(arg != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(ov != NULL); + nonnull_assert(arg != NULL); superClasses = PrecedenceOrder(cl); subClasses = DependentSubClasses(cl); @@ -10645,8 +10656,8 @@ static int CheckVarName(Tcl_Interp *interp, const char *varNameString) { - assert(interp != NULL); - assert(varNameString != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(varNameString != NULL); /* * We want to have a plain variable name, since we do not want to @@ -10690,9 +10701,9 @@ Var *varPtr, *arrayPtr; int result; - assert(interp != NULL); - assert(object != NULL); - assert(name1 != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(name1 != NULL); Nsf_PushFrameObj(interp, object, framePtr); @@ -10782,10 +10793,10 @@ Namespace *nsPtr; Tcl_Obj *bodyObj; - assert(interp != NULL); - assert(flagsPtr != NULL); - assert(procPtr != NULL); - assert(procName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(flagsPtr != NULL); + nonnull_assert(procPtr != NULL); + nonnull_assert(procName != NULL); nsPtr = procPtr->cmdPtr->nsPtr; bodyObj = procPtr->bodyPtr; @@ -10878,10 +10889,10 @@ Tcl_CallFrame *framePtr; int result; - assert(procPtr != NULL); - assert(interp != NULL); - assert(objv != NULL); - assert(cscPtr != NULL); + nonnull_assert(procPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(cscPtr != NULL); /* * Set up and push a new call frame for the new procedure invocation. @@ -10934,9 +10945,9 @@ NsfObjectSystem *osPtr, *defOsPtr; char firstChar; - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); firstChar = *methodName; defOsPtr = GetObjectSystem(object); @@ -11098,7 +11109,7 @@ static void ParamFree(Nsf_Param *paramPtr) { - assert(paramPtr != NULL); + nonnull_assert(paramPtr != NULL); /*fprintf(stderr, "ParamFree %p\n", paramPtr);*/ if (paramPtr->name != NULL) {STRING_FREE("paramPtr->name", paramPtr->name);} @@ -11130,7 +11141,7 @@ ParamsFree(Nsf_Param *paramsPtr) { Nsf_Param *paramPtr; - assert(paramsPtr != NULL); + nonnull_assert(paramsPtr != NULL); /*fprintf(stderr, "ParamsFree %p\n", paramsPtr);*/ for (paramPtr = paramsPtr; paramPtr->name; paramPtr++) { @@ -11160,7 +11171,7 @@ NSF_INLINE static NsfParamDefs * ParamDefsGet(Tcl_Command cmdPtr, int *checkAlwaysFlagPtr) { - assert(cmdPtr != NULL); + nonnull_assert(cmdPtr != NULL); if (likely(Tcl_Command_deleteProc(cmdPtr) == NsfProcDeleteProc)) { NsfProcContext *ctx = (NsfProcContext *)Tcl_Command_deleteData(cmdPtr); @@ -11256,15 +11267,15 @@ char ch1; int length; - assert(interp != NULL); - assert(nameString != NULL); - assert(paramsPtr != NULL); - assert(paramPtrPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameString != NULL); + nonnull_assert(paramsPtr != NULL); + nonnull_assert(paramPtrPtr != NULL); /* * The provided paramsPtr must point to a block starting with a nonpos arg. */ - assert(paramsPtr->name); + assert(paramsPtr->name != NULL); assert(*paramsPtr->name == '-'); /* @@ -11345,7 +11356,7 @@ NsfProcDeleteProc(ClientData clientData) { NsfProcContext *ctxPtr; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); ctxPtr = (NsfProcContext *)clientData; if (ctxPtr->oldDeleteProc != NULL) { @@ -11382,8 +11393,8 @@ ParamDefsStore(Tcl_Interp *interp, Tcl_Command cmd, NsfParamDefs *paramDefs, int checkAlwaysFlag) { Command *cmdPtr; - assert(interp != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmd != NULL); cmdPtr = (Command *)cmd; /* @@ -11477,7 +11488,7 @@ /*fprintf(stderr, "ParamDefsFree %p slotObj %p returns %p\n", paramDefs, paramDefs->slotObj, paramDefs->returns);*/ - assert(paramDefs != NULL); + nonnull_assert(paramDefs != NULL); if (paramDefs->paramsPtr != NULL) { ParamsFree(paramDefs->paramsPtr); @@ -11511,15 +11522,15 @@ static void ParamDefsRefCountIncr(NsfParamDefs *paramDefs) { - assert(paramDefs != NULL); + nonnull_assert(paramDefs != NULL); paramDefs->refCount ++; } static void ParamDefsRefCountDecr(NsfParamDefs *paramDefs) { - assert(paramDefs != NULL); + nonnull_assert(paramDefs != NULL); paramDefs->refCount --; if (paramDefs->refCount < 1) { @@ -11550,10 +11561,10 @@ ParamDefsFormatOption(Tcl_Obj *nameStringObj, const char *option, int *colonWritten, int *firstOption) { - assert(nameStringObj != NULL); - assert(option != NULL); - assert(colonWritten != NULL); - assert(firstOption != NULL); + nonnull_assert(nameStringObj != NULL); + nonnull_assert(option != NULL); + nonnull_assert(colonWritten != NULL); + nonnull_assert(firstOption != NULL); if (!*colonWritten) { Tcl_AppendLimitedToObj(nameStringObj, ":", 1, INT_MAX, NULL); @@ -11598,8 +11609,8 @@ int first, colonWritten; Tcl_Obj *listObj = Tcl_NewListObj(0, NULL), *innerListObj, *nameStringObj; - assert(interp != NULL); - assert(paramsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramsPtr != NULL); INCR_REF_COUNT2("paramDefsObj", listObj); @@ -11709,8 +11720,8 @@ ParamDefsList(Tcl_Interp *interp, Nsf_Param const *paramsPtr, NsfObject *contextObject, const char *pattern) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); - assert(interp != NULL); - assert(paramsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramsPtr != NULL); INCR_REF_COUNT2("paramDefsObj", listObj); @@ -11751,8 +11762,8 @@ ParamDefsNames(Tcl_Interp *interp, Nsf_Param const *paramsPtr, NsfObject *contextObject, const char *pattern) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL), *obj; - assert(interp != NULL); - assert(paramsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramsPtr != NULL); INCR_REF_COUNT2("paramDefsObj", listObj); @@ -11795,7 +11806,7 @@ ParamGetType(Nsf_Param const *paramPtr) { const char *result = "value"; - assert(paramPtr != NULL); + nonnull_assert(paramPtr != NULL); if (paramPtr->type != NULL) { if (paramPtr->converter == ConvertViaCmd) { @@ -11841,7 +11852,7 @@ ParamGetDomain(Nsf_Param const *paramPtr) { const char *result = "value"; - assert(paramPtr != NULL); + nonnull_assert(paramPtr != NULL); if ((paramPtr->flags & NSF_ARG_IS_ENUMERATION) != 0u) { return Nsf_EnumerationTypeGetDomain(paramPtr->converter); @@ -11873,8 +11884,8 @@ static void NsfParamDefsSyntaxOne(Tcl_Obj *argStringObj, Nsf_Param const *pPtr) { - assert(argStringObj != NULL); - assert(pPtr != NULL); + nonnull_assert(argStringObj != NULL); + nonnull_assert(pPtr != NULL); if (pPtr->nrArgs > 0 && *pPtr->name == '-') { Tcl_AppendLimitedToObj(argStringObj, pPtr->name, -1, INT_MAX, NULL); @@ -11923,11 +11934,11 @@ NsfParsedParam parsedParam; int result; - assert(interp != NULL); - assert(pPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(pPtr != NULL); assert(pPtr->type != NULL); - assert(contextObject != NULL); - assert(formatFunction != NULL); + nonnull_assert(contextObject != NULL); + nonnull_assert(formatFunction != NULL); if (strcmp(pPtr->type, "virtualobjectargs") == 0) { result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], contextObject, NULL, &parsedParam); @@ -11964,12 +11975,13 @@ NsfParamDefsAppendVirtual(Tcl_Interp *interp, Tcl_Obj *listObj, Nsf_Param const *paramsPtr, NsfObject *contextObject, const char *pattern, NsfFormatFunction formatFunction) { - assert(interp != NULL); - assert(listObj != NULL); - assert(paramsPtr != NULL); - assert(paramsPtr->name); - assert(formatFunction != NULL); - + nonnull_assert(interp != NULL); + nonnull_assert(listObj != NULL); + nonnull_assert(paramsPtr != NULL); + nonnull_assert(formatFunction != NULL); + + assert(paramsPtr->name != NULL); + if (paramsPtr->converter == ConvertToNothing && strcmp(paramsPtr->name, "args") == 0) { if ((contextObject != NULL) @@ -12015,8 +12027,8 @@ Nsf_Param const *pPtr; int needSpace = 0; - assert(interp != NULL); - assert(paramsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramsPtr != NULL); INCR_REF_COUNT2("paramDefsObj", argStringObj); @@ -12113,7 +12125,7 @@ static void ParsedParamFree(NsfParsedParam *parsedParamPtr) { - assert(parsedParamPtr != NULL); + nonnull_assert(parsedParamPtr != NULL); /*fprintf(stderr, "ParsedParamFree %p, npargs %p\n", parsedParamPtr, parsedParamPtr->paramDefs);*/ @@ -12160,8 +12172,8 @@ NsfObjectOpt *opt = object->opt; #endif - assert(data != NULL); - assert(interp != NULL); + nonnull_assert(data != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, "ProcMethodDispatchFinalize %s %s flags %.6x isNRE %d pcPtr %p result %d\n", ObjectName(object), methodName, @@ -12220,8 +12232,8 @@ /*const char *methodName = data[0]; fprintf(stderr, "ProcDispatchFinalize of method %s\n", methodName);*/ - assert(data != NULL); - assert(interp != NULL); + nonnull_assert(data != NULL); + nonnull_assert(interp != NULL); # if defined(NSF_PROFILE) long int startUsec = (long int)data[2]; @@ -12274,14 +12286,15 @@ ParseContext pc, *pcPtr = &pc; #endif - assert(cp != NULL); - assert(interp != NULL); - assert(objv != NULL); - assert(methodName != NULL); - assert(cmdPtr != NULL); - assert(cscPtr != NULL); - assert(object != NULL); - assert(object->teardown); + nonnull_assert(cp != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmdPtr != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(object != NULL); + + assert(object->teardown != NULL); #if defined(NRE) /*fprintf(stderr, "ProcMethodDispatch cmd %s\n", Tcl_GetCommandName(interp, cmdPtr));*/ @@ -12459,11 +12472,12 @@ CallFrame frame, *framePtr = &frame; int result; - assert(interp != NULL); - assert(objv != NULL); - assert(cmd != NULL); - assert(object != NULL); - assert(object->teardown); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(object != NULL); + + assert(object->teardown != NULL); #if defined(NRE) assert(!cscPtr || (cscPtr->flags & NSF_CSC_CALL_IS_NRE) == 0u); @@ -12535,12 +12549,12 @@ NsfClass *actualClass; int result; - assert(invokedObject != NULL); - assert(interp != NULL); - assert(objv != NULL); - assert(methodName != NULL); - assert(callerSelf != NULL); - assert(cscPtr != NULL); + nonnull_assert(invokedObject != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(callerSelf != NULL); + nonnull_assert(cscPtr != NULL); cmd = cscPtr->cmdPtr; /*fprintf(stderr, "ObjectCmdMethodDispatch %p %s\n", cmd, Tcl_GetCommandName(interp, cmd));*/ @@ -12874,9 +12888,9 @@ int somevar; NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(interp != NULL); - assert(prefix != NULL); - assert(fullMethodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(prefix != NULL); + nonnull_assert(fullMethodName != NULL); if (rst->exitHandlerDestroyRound == NSF_EXITHANDLER_OFF) { # if TCL_STACK_GROWS_UP @@ -12940,13 +12954,13 @@ Tcl_ObjCmdProc *proc = Tcl_Command_objProc(cmd); NsfCallStackContent *cscPtr1; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); - assert(cmd != NULL); - assert(cscPtr != NULL); - assert(methodName != NULL); - assert(validCscPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(validCscPtr != NULL); object = cscPtr->self; /* @@ -12964,7 +12978,7 @@ /*fprintf(stderr, "MethodDispatch method '%s' cmd %p cp=%p objc=%d cscPtr %p csc->flags %.6x " "obj->flags %.6x teardown %p\n", methodName, cmd, cp, objc, cscPtr, cscPtr->flags, object->flags, object->teardown);*/ - assert(object->teardown); + assert(object->teardown != NULL); /* * The default assumption is that the CscPtr is valid after this function @@ -13118,13 +13132,14 @@ int result, isValidCsc = 1; Tcl_Command resolvedCmd; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); - assert(cmd != NULL); - assert(object != NULL); - assert(methodName != NULL); - assert(object->teardown); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); + + assert(object->teardown != NULL); CheckCStack(interp, "method", methodName); @@ -13195,12 +13210,12 @@ NsfObject *object; unsigned int flags; - assert(interp != NULL); - assert(cscPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); + object = cscPtr->self; - assert(object != NULL); - assert(object->id); + assert(object->id != NULL); flags = cscPtr->flags; @@ -13271,9 +13286,9 @@ Tcl_Command cmd; NsfClasses *p; - assert(interp != NULL); - assert(cl != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(methodName != NULL); /*fprintf(stderr, "NsfFindClassMethod %s %s\n", ClassName(cl), methodName);*/ for(p = PrecedenceOrder(cl); p; p = p->nextPtr) { @@ -13332,8 +13347,8 @@ int isValidCsc = 1; NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); /* none of the higher copy-flags must be passed */ assert((flags & (NSF_CSC_COPY_FLAGS & 0x000FFF000U)) == 0u); @@ -13352,7 +13367,7 @@ ObjectName(object), methodName); } } - assert(object->teardown); + assert(object->teardown != NULL); #if defined(METHOD_OBJECT_TRACE) fprintf(stderr, "method %p/%d '%s' type %p <%s>\n", @@ -13802,9 +13817,9 @@ int result; Tcl_Obj *methodObj; - assert(interp != NULL); - assert(object != NULL); - assert(obj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(obj != NULL); if (CallDirectly(interp, object, NSF_o_defaultmethod_idx, &methodObj)) { @@ -13849,8 +13864,8 @@ Tcl_Obj *methodObj; NsfRuntimeState *rst; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); rst = RUNTIME_STATE(interp); /* @@ -13926,8 +13941,8 @@ int result; Tcl_Obj *methodObj; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /* * check, whether init was called already @@ -13986,10 +14001,10 @@ const char *methodName = MethodName(methodObj); NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(interp != NULL); - assert(object != NULL); - assert(objv != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(methodObj != NULL); /*fprintf(stderr, "compare unknownObj %p with methodObj %p '%s' %p %p %s -- %s\n", unknownObj, methodObj, ObjStr(methodObj), callInfoObj, (callInfoObj != NULL) ?objv[1]:NULL, (callInfoObj != NULL) ?ObjStr(objv[1]) : NULL, @@ -14073,9 +14088,9 @@ int NsfObjDispatch(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); return Tcl_NRCallObjProc(interp, NsfObjDispatchNRE, clientData, objc, objv); } @@ -14096,9 +14111,9 @@ NsfStackDump(interp); #endif - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); if (likely(objc > 1)) { /* @@ -14138,8 +14153,8 @@ AddPrefixToBody(Tcl_Obj *body, int paramDefs, NsfParsedParam *paramPtr) { Tcl_Obj *resultBody = Tcl_NewObj(); - assert(body != NULL); - assert(paramPtr != NULL); + nonnull_assert(body != NULL); + nonnull_assert(paramPtr != NULL); INCR_REF_COUNT2("resultBody", resultBody); @@ -14157,7 +14172,7 @@ NoMetaChars(const char *pattern) { register char c; - assert(pattern != NULL); + nonnull_assert(pattern != NULL); for (c = *pattern; c; c = *++pattern) { if (c == '*' || c == '?' || c == '[') { @@ -14195,9 +14210,9 @@ Nsf_ConvertToString(Tcl_Interp *UNUSED(interp), Tcl_Obj *objPtr, Nsf_Param const *UNUSED(pPtr), ClientData *clientData, Tcl_Obj **outObjPtr) { - assert(objPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); *clientData = (char *)ObjStr(objPtr); assert(*outObjPtr == objPtr); @@ -14228,8 +14243,8 @@ ConvertToNothing(Tcl_Interp *UNUSED(interp), Tcl_Obj *objPtr, Nsf_Param const *UNUSED(pPtr), ClientData *UNUSED(clientData), Tcl_Obj **outObjPtr) { - assert(objPtr != NULL); - assert(outObjPtr != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); *outObjPtr = objPtr; @@ -14270,11 +14285,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { int result; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); if (unlikely(pPtr->converterArg != NULL)) { Tcl_Obj *objv[4]; @@ -14348,11 +14363,11 @@ int result, bool; result = Tcl_GetBooleanFromObj(interp, objPtr, &bool); - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); if (likely(result == TCL_OK)) { *clientData = (ClientData)INT2PTR(bool); @@ -14389,11 +14404,11 @@ int result; int i; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); result = Tcl_GetIntFromObj(interp, objPtr, &i); @@ -14434,11 +14449,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { int result; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); /* * Try to short_cut common cases to avoid conversion to bignums, since @@ -14509,11 +14524,11 @@ int Nsf_ConvertToSwitch(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); return Nsf_ConvertToBoolean(interp, objPtr, pPtr, clientData, outObjPtr); } @@ -14543,11 +14558,11 @@ Nsf_ConvertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); if (likely(GetObjectFromObj(interp, objPtr, (NsfObject **)clientData) == TCL_OK)) { @@ -14581,11 +14596,11 @@ Nsf_ConvertToClass(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); if (likely(GetClassFromObj(interp, objPtr, (NsfClass **)clientData, 0) == TCL_OK)) { @@ -14623,11 +14638,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { int result; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); result = Tcl_ConvertToType(interp, objPtr, &NsfFilterregObjType); @@ -14665,11 +14680,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { int result; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); result = Tcl_ConvertToType(interp, objPtr, &NsfMixinregObjType); @@ -14707,11 +14722,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { const char *value = ObjStr(objPtr); - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert(*outObjPtr == objPtr); /*fprintf(stderr, "convert to parameter '%s' t '%s'\n", value, pPtr->type);*/ @@ -14753,11 +14768,11 @@ NsfObject *object; int result, oc; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); /* * In general, when the converter is used e.g. for result checking, @@ -14875,10 +14890,10 @@ Tcl_Obj *patternObj = objPtr; const char *pattern = ObjStr(objPtr); - assert(interp != NULL); - assert(objPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); if (NoMetaChars(pattern)) { /* @@ -14934,7 +14949,7 @@ ParamCheckObj(const char *start, size_t len) { Tcl_Obj *checker = Tcl_NewStringObj("type=", 5); - assert(start != NULL); + nonnull_assert(start != NULL); Tcl_AppendLimitedToObj(checker, start, len, INT_MAX, NULL); return checker; @@ -14963,10 +14978,10 @@ ParamOptionSetConverter(Tcl_Interp *interp, Nsf_Param *paramPtr, const char *typeName, Nsf_TypeConverter *converter) { - assert(interp != NULL); - assert(paramPtr != NULL); - assert(typeName != NULL); - assert(converter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(typeName != NULL); + nonnull_assert(converter != NULL); if (paramPtr->converter != NULL) { return NsfPrintError(interp, "refuse to redefine parameter type of '%s' from type '%s' to type '%s'", @@ -14998,11 +15013,14 @@ static void Unescape(Tcl_Obj *objPtr) { - int i, j, l = Tcl_GetCharLength(objPtr); - char *string = ObjStr(objPtr); + int i, j, l; + char *string; - assert(objPtr != NULL); + nonnull_assert(objPtr != NULL); + l = Tcl_GetCharLength(objPtr); + string = ObjStr(objPtr); + for (i = 0; i < l; i++) { if (string[i] == ',' && string[i+1] == ',') { for (j = i+1; j < l; j++) { @@ -15045,9 +15063,9 @@ const char *dotdot, *option = argString + start; int result = TCL_OK; - assert(interp != NULL); - assert(argString != NULL); - assert(paramPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(argString != NULL); + nonnull_assert(paramPtr != NULL); /*fprintf(stderr, "ParamOptionParse name %s, option '%s' (%ld) disallowed %.6x\n", paramPtr->name, option, start, disallowedOptions);*/ @@ -15346,12 +15364,12 @@ const char *argString, *argName; Tcl_Obj **npav; - assert(interp != NULL); - assert(arg != NULL); - assert(paramPtr != NULL); - assert(possibleUnknowns != NULL); - assert(plainParams != NULL); - assert(nrNonposArgs != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(arg != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(possibleUnknowns != NULL); + nonnull_assert(plainParams != NULL); + nonnull_assert(nrNonposArgs != NULL); paramPtr->paramObj = arg; INCR_REF_COUNT(paramPtr->paramObj); @@ -15645,9 +15663,9 @@ Tcl_Obj **argsv; int result, argsc; - assert(interp != NULL); - assert(paramSpecObjs != NULL); - assert(parsedParamPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramSpecObjs != NULL); + nonnull_assert(parsedParamPtr != NULL); parsedParamPtr->paramDefs = NULL; parsedParamPtr->possibleUnknowns = 0; @@ -15761,9 +15779,9 @@ ForwardCmdClientData *tcd = NULL; int result, oc, nobjc; - assert(interp != NULL); - assert(object != NULL); - assert(paramPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(paramPtr != NULL); assert((paramPtr->flags & NSF_ARG_FORWARD) != 0u); forwardSpec = (paramPtr->method != NULL) ? paramPtr->method : NULL; /* different default? */ @@ -15856,12 +15874,12 @@ CallFrame frame2, *framePtr2 = &frame2; int result = TCL_OK; - assert(interp != NULL); - assert(object != NULL); - assert(paramPtr != NULL); - assert(newValue != NULL); - assert(initString != NULL); - assert(nextObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(newValue != NULL); + nonnull_assert(initString != NULL); + nonnull_assert(nextObjPtr != NULL); #if 0 {int i; @@ -16078,12 +16096,12 @@ Tcl_Obj *ov[4]; int result; - assert(nsPtr != NULL); - assert(interp != NULL); - assert(nameObj != NULL); - assert(args != NULL); - assert(body != NULL); - assert(defObject != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(args != NULL); + nonnull_assert(body != NULL); + nonnull_assert(defObject != NULL); assert(*methodName != ':'); if (regObject == NULL) {regObject = defObject;} @@ -16205,11 +16223,11 @@ const char *argsStr = ObjStr(args), *bodyStr = ObjStr(body), *nameStr = ObjStr(nameObj); int result; - assert(interp != NULL); - assert(defObject != NULL); - assert(nameObj != NULL); - assert(args != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(defObject != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(args != NULL); + nonnull_assert(body != NULL); if (precondition != NULL && postcondition == NULL) { return NsfPrintError(interp, "%s method '%s'; when specifying a precondition (%s)" @@ -16357,10 +16375,10 @@ } #endif - assert(interp != NULL); - assert(procNameObj != NULL); - assert(cmd != NULL); - assert(pcPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(procNameObj != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(pcPtr != NULL); objv = pcPtr->full_objv; objc = pcPtr->objc+1; @@ -16484,9 +16502,9 @@ NsfProcClientData *tcd; int result; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); tcd = clientData; @@ -16573,10 +16591,10 @@ int result, checkAlwaysFlag; Tcl_Command cmd; - assert(interp != NULL); - assert(parsedParamPtr != NULL); - assert(procName != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(parsedParamPtr != NULL); + nonnull_assert(procName != NULL); + nonnull_assert(body != NULL); Tcl_DStringInit(dsPtr); @@ -16746,11 +16764,11 @@ int result; CallFrame frame, *framePtr = &frame; - assert(pcPtr != NULL); - assert(interp != NULL); - assert(paramDefs != NULL); - assert(methodNameObj != NULL); - assert(objv != NULL); + nonnull_assert(pcPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramDefs != NULL); + nonnull_assert(methodNameObj != NULL); + nonnull_assert(objv != NULL); if (object != NULL && (processFlags & NSF_ARGPARSE_METHOD_PUSH) != 0u ) { Nsf_PushFrameObj(interp, object, framePtr); @@ -16859,7 +16877,7 @@ ForwardCmdDeleteProc(ClientData clientData) { ForwardCmdClientData *tcd; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); tcd = (ForwardCmdClientData *)clientData; if (tcd->cmdName != NULL) {DECR_REF_COUNT(tcd->cmdName);} @@ -16893,7 +16911,7 @@ SetterCmdDeleteProc(ClientData clientData) { SetterCmdClientData *setterClientData; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); setterClientData = (SetterCmdClientData *)clientData; if (setterClientData->paramsPtr != NULL) { @@ -16923,7 +16941,7 @@ AliasCmdDeleteProc(ClientData clientData) { AliasCmdClientData *tcd; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); /* * Since we just get the clientData, we have to obtain interp, @@ -16999,9 +17017,9 @@ GetMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, NsfObject **matchObjectPtr, const char **patternPtr) { - assert(interp != NULL); - assert(matchObjectPtr != NULL); - assert(patternPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(matchObjectPtr != NULL); + nonnull_assert(patternPtr != NULL); if (patternObj != NULL) { *patternPtr = ObjStr(patternObj); @@ -17046,9 +17064,9 @@ ForwardCmdClientData *tcd; int i, result = 0; - assert(interp != NULL); - assert(nameObj != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(objv != NULL); tcd = NEW(ForwardCmdClientData); memset(tcd, 0, sizeof(ForwardCmdClientData)); @@ -17170,7 +17188,7 @@ static const char * StripBodyPrefix(const char *body) { - assert(body != NULL); + nonnull_assert(body != NULL); if (strncmp(body, "::nsf::__unset_unknown_args\n", 28) == 0) { body += 28; @@ -17208,10 +17226,10 @@ Tcl_DString ds, *dsPtr = &ds; int isFullQualPattern = (pattern && *pattern == ':' && *(pattern+1) == ':'); - assert(interp != NULL); - assert(parent != NULL); - assert(prefix != NULL); - assert(listObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(parent != NULL); + nonnull_assert(prefix != NULL); + nonnull_assert(listObj != NULL); /*fprintf(stderr, "AddSlotObjects parent %s prefix %s type %p %s\n", ObjectName(parent), prefix, type, (type != NULL) ? ClassName(type) : "");*/ @@ -17331,8 +17349,8 @@ const char *methodName; Tcl_Command cmd; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (cscPtr->frameType == NSF_CSC_TYPE_PLAIN) { return cscPtr->cl; @@ -17387,16 +17405,16 @@ int *endOfFilterChain, Tcl_Command *currentCmdPtr) { int endOfChain = 0, objflags; - assert(object != NULL); - assert(interp != NULL); - assert(cscPtr != NULL); - assert(clPtr != NULL); - assert(methodNamePtr != NULL); - assert(cmdPtr != NULL); - assert(isMixinEntry != NULL); - assert(isFilterEntry != NULL); - assert(endOfFilterChain != NULL); - assert(currentCmdPtr != NULL); + nonnull_assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(clPtr != NULL); + nonnull_assert(methodNamePtr != NULL); + nonnull_assert(cmdPtr != NULL); + nonnull_assert(isMixinEntry != NULL); + nonnull_assert(isFilterEntry != NULL); + nonnull_assert(endOfFilterChain != NULL); + nonnull_assert(currentCmdPtr != NULL); /*fprintf(stderr, "NextSearchMethod for %s called with cl %p\n", *methodNamePtr, *clPtr);*/ @@ -17565,11 +17583,11 @@ Tcl_CallFrame *framePtr; NsfCallStackContent *cscPtr = CallStackGetTopFrame(interp, &framePtr); - assert(interp != NULL); - assert(cscPtrPtr != NULL); - assert(methodNamePtr != NULL); - assert(outObjc != NULL); - assert(outObjv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtrPtr != NULL); + nonnull_assert(methodNamePtr != NULL); + nonnull_assert(outObjc != NULL); + nonnull_assert(outObjv != NULL); assert(freeArgumentVector != NULL); /* always make sure, we only decrement when necessary */ @@ -17692,8 +17710,8 @@ Tcl_Obj **nobjv = data[0]; NsfCallStackContent *cscPtr = data[1]; - assert(data != NULL); - assert(interp != NULL); + nonnull_assert(data != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, "***** NextInvokeFinalize cscPtr %p flags %.6x is next %d result %d unk %d\n", cscPtr, cscPtr->flags, cscPtr->flags & NSF_CSC_CALL_IS_NEXT, result, @@ -17757,10 +17775,10 @@ NsfObject *object; NsfClass *cl; - assert(interp != NULL); - assert(methodName != NULL); - assert(objv != NULL); - assert(cscPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(cscPtr != NULL); /* * Search the next method & compute its method data @@ -17970,8 +17988,8 @@ NsfCallStackContent *cscPtr; Tcl_Obj **nobjv; - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); if (likely(objc < 2)) { /* No arguments were provided */ @@ -18026,7 +18044,7 @@ NsfObject *object = cscPtr->self; const char *methodName; - assert(interp != NULL); + nonnull_assert(interp != NULL); Tcl_ResetResult(interp); @@ -18067,7 +18085,7 @@ Tcl_CallFrame *framePtr; Tcl_Obj *resultObj; - assert(interp != NULL); + nonnull_assert(interp != NULL); switch (level) { case CALLING_LEVEL: NsfCallStackFindLastInvocation(interp, 1, &framePtr); break; @@ -18134,9 +18152,9 @@ Tcl_HashEntry *entryPtr; Tcl_Var *varPtr; - assert(interp != NULL); - assert(nsPtr != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); + nonnull_assert(name != NULL); /*fprintf(stderr, "### UnsetInAllNamespaces variable '%s', current namespace '%s'\n", name, (nsPtr != NULL) ? nsPtr->fullName : "NULL");*/ @@ -18193,8 +18211,8 @@ static int FreeUnsetTraceVariable(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->opt != NULL && object->opt->volatileVarName) { int result = Tcl_UnsetVar2(interp, object->opt->volatileVarName, NULL, 0); @@ -18256,8 +18274,8 @@ NsfObject *object; const char *resultMsg = NULL; - assert(clientData != NULL); - assert(interp != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, "NsfUnsetTrace %s flags %.4x %.4x\n", name, flags, flags & TCL_INTERP_DESTROYED);*/ @@ -18309,8 +18327,8 @@ static void CleanupDestroyObject(Tcl_Interp *interp, NsfObject *object, int softrecreate) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "CleanupDestroyObject obj %p softrecreate %d nsPtr %p\n", object, softrecreate, object->nsPtr);*/ @@ -18415,8 +18433,8 @@ CleanupInitObject(Tcl_Interp *interp, NsfObject *object, NsfClass *cl, Tcl_Namespace *nsPtr, int softrecreate) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #ifdef OBJDELETION_TRACE fprintf(stderr, "+++ CleanupInitObject\n"); @@ -18456,7 +18474,7 @@ static void PrimitiveDestroy(ClientData clientData) { - assert(clientData != NULL); + nonnull_assert(clientData != NULL); if (NsfObjectIsClass((NsfObject *)clientData)) { PrimitiveCDestroy(clientData); @@ -18487,7 +18505,7 @@ NsfObject *object; Tcl_Interp *interp; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); object = (NsfObject *)clientData; /* @@ -18536,10 +18554,10 @@ NsfObject *object; Tcl_Interp *interp; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); object = (NsfObject *)clientData; - assert(object->teardown); + assert(object->teardown != NULL); /*fprintf(stderr, "****** PrimitiveODestroy %p cmd %p flags %.6x\n", (void *)object, (void *)object->id, object->flags);*/ @@ -18625,8 +18643,8 @@ DoDealloc(Tcl_Interp *interp, NsfObject *object) { int result; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "DoDealloc obj= %s %p flags %.6x activation %d cmd %p opt=%p\n", ObjectName(object), object, object->flags, object->activationCount, @@ -18669,7 +18687,7 @@ static void MarkUndestroyed(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); object->flags &= ~NSF_DESTROY_CALLED; } @@ -18696,9 +18714,9 @@ PrimitiveOInit(NsfObject *object, Tcl_Interp *interp, const char *name, Tcl_Namespace *nsPtr, NsfClass *cl) { - assert(object != NULL); - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); #ifdef OBJDELETION_TRACE fprintf(stderr, "+++ PrimitiveOInit\n"); @@ -18771,9 +18789,9 @@ Tcl_Namespace *nsPtr; NsfObject *object; - assert(interp != NULL); - assert(nameObj != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(cl != NULL); object = (NsfObject *)ckalloc(sizeof(NsfObject)); MEM_COUNT_ALLOC("NsfObject/NsfClass", object); @@ -18843,9 +18861,9 @@ NsfClass *resultClass = NULL; Tcl_Obj *resultObj; - assert(interp != NULL); - assert(cl != NULL); - assert(mCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(mCl != NULL); /*fprintf(stderr, "DefaultSuperClass cl %s, mcl %s, isMeta %d\n", ClassName(cl), ClassName(mCl), isMeta );*/ @@ -18932,8 +18950,8 @@ NsfClass *baseClass = NULL; NsfClasses *subClasses; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); PRINTOBJ("CleanupDestroyClass", (NsfObject *)cl); assert((softrecreate != 0) ? recreate == 1 : 1); @@ -19114,9 +19132,9 @@ int softrecreate, int recreate) { NsfClass *defaultSuperclass; - assert(interp != NULL); - assert(cl != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(nsPtr != NULL); assert((softrecreate != 0) ? recreate == 1 : 1); #ifdef OBJDELETION_TRACE @@ -19187,7 +19205,7 @@ Tcl_Interp *interp; Tcl_Namespace *saved; - assert(clientData != NULL); + nonnull_assert(clientData != NULL); cl = (NsfClass *)clientData; object = (NsfObject *)clientData; @@ -19258,9 +19276,9 @@ Tcl_CallFrame frame, *framePtr = &frame; Tcl_Namespace *nsPtr; - assert(cl != NULL); - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); /* * Ensure that namespace is newly created during CleanupInitClass. Kill it, @@ -19306,8 +19324,8 @@ NsfObject *object; NsfClass *cl; - assert(interp != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); cl = (NsfClass *)ckalloc(sizeof(NsfClass)); nameString = ObjStr(nameObj); @@ -19384,9 +19402,9 @@ NSF_INLINE static int ChangeClass(Tcl_Interp *interp, NsfObject *object, NsfClass *cl) { - assert(interp != NULL); - assert(object != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cl != NULL); NsfInstanceMethodEpochIncr("ChangeClass"); @@ -19449,9 +19467,9 @@ Tcl_Obj *methodObj, *savedObjResult; int result; - assert(interp != NULL); - assert(object != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(objv != NULL); assert(objc >= 0); #if 0 @@ -19549,7 +19567,7 @@ static int IsRootMetaClass(NsfClass *cl) { - assert(cl != NULL); + nonnull_assert(cl != NULL); return ((cl->object.flags & NSF_IS_ROOT_META_CLASS) != 0u); } @@ -19571,7 +19589,7 @@ static int IsBaseClass(NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); return ((object->flags & (NSF_IS_ROOT_CLASS|NSF_IS_ROOT_META_CLASS)) != 0u); } @@ -19593,7 +19611,7 @@ static int IsRootClass(NsfClass *cls) { - assert(cls != NULL); + nonnull_assert(cls != NULL); return ((cls->object.flags & (NSF_IS_ROOT_CLASS)) != 0u); } @@ -19618,8 +19636,8 @@ IsMetaClass(Tcl_Interp *interp, NsfClass *cl, int withMixins) { NsfClasses *pl; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); /* is the class the most general meta-class? */ if (IsRootMetaClass(cl)) { @@ -19679,8 +19697,8 @@ static int IsSubType(NsfClass *subcl, NsfClass *cl) { - assert(subcl != NULL); - assert(cl != NULL); + nonnull_assert(subcl != NULL); + nonnull_assert(cl != NULL); if (cl != subcl) { return NsfClassListFind(PrecedenceOrder(subcl), cl) != NULL; @@ -19708,9 +19726,9 @@ static int HasMixin(Tcl_Interp *interp, NsfObject *object, NsfClass *cl) { - assert(interp != NULL); - assert(object != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cl != NULL); if ((object->flags & NSF_MIXIN_ORDER_VALID) == 0u) { MixinComputeDefined(interp, object); @@ -19757,10 +19775,10 @@ CallFrame frame, *framePtr = &frame; const char *varNameString; - assert(interp != NULL); - assert(cmdName != NULL); - assert(object != NULL); - assert(varName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(object != NULL); + nonnull_assert(varName != NULL); if (unlikely(CheckVarName(interp, ObjStr(varName)) != TCL_OK)) { return TCL_ERROR; @@ -19904,9 +19922,9 @@ Tcl_Obj *resultObj; unsigned int flags; - assert(interp != NULL); - assert(object != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(nameObj != NULL); flags = (object->nsPtr) ? TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY : TCL_LEAVE_ERR_MSG; Nsf_PushFrameObj(interp, object, framePtr); @@ -19951,9 +19969,9 @@ int result; Tcl_Obj *ov[4]; - assert(interp != NULL); - assert(object != NULL); - assert(arrayNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(arrayNameObj != NULL); Nsf_PushFrameObj(interp, object, framePtr); @@ -20007,9 +20025,9 @@ unsigned int flags; int result; - assert(interp != NULL); - assert(object != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(name != NULL); flags = (withNocomplain != 0) ? 0 : TCL_LEAVE_ERR_MSG; if (object->nsPtr != NULL) {flags |= TCL_NAMESPACE_ONLY;} @@ -20046,9 +20064,9 @@ SetterCmdClientData *cd = (SetterCmdClientData *)clientData; NsfObject *object = cd->object; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); if (objc > 2) { return NsfObjWrongArgs(interp, "wrong # args", object->cmdName, @@ -20118,9 +20136,9 @@ va_list ap; int result; - assert(interp != NULL); - assert(tcd != NULL); - assert(fmt != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(tcd != NULL); + nonnull_assert(fmt != NULL); Tcl_DStringInit(&ds); @@ -20193,15 +20211,15 @@ int totalargs; char c = *ForwardArgString; - assert(interp != NULL); - assert(objv != NULL); - assert(forwardArgObj != NULL); - assert(tcd != NULL); - assert(out != NULL); - assert(freeList != NULL); - assert(inputArg != NULL); - assert(mapvalue != NULL); - assert(outputincr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(forwardArgObj != NULL); + nonnull_assert(tcd != NULL); + nonnull_assert(out != NULL); + nonnull_assert(freeList != NULL); + nonnull_assert(inputArg != NULL); + nonnull_assert(mapvalue != NULL); + nonnull_assert(outputincr != NULL); totalargs = objc + tcd->nr_args - 1; /* @@ -20465,9 +20483,9 @@ NsfObject *object; CallFrame frame, *framePtr = &frame; - assert(tcd != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(tcd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); object = tcd->object; tcd->object = NULL; @@ -20538,9 +20556,9 @@ ForwardCmdClientData *tcd = (ForwardCmdClientData *)clientData; int result, inputArg = 1; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); if (unlikely(!tcd || !tcd->object)) { return NsfDispatchClientDataError(interp, tcd, "object", @@ -20763,9 +20781,9 @@ Tcl_Obj *CONST objv[]) { AliasCmdClientData *tcd = (AliasCmdClientData *)clientData; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); return NsfDispatchClientDataError(interp, NULL, "object", Tcl_GetCommandName(interp, tcd->aliasCmd)); @@ -20797,9 +20815,9 @@ CallFrame frame, *framePtr = &frame; int result; - assert(clientData != NULL); - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); /*fprintf(stderr, "objscopedMethod obj=%p %s, ptr=%p\n", object, ObjectName(object), tcd->objProc);*/ tcd->object = NULL; @@ -20838,11 +20856,11 @@ int *objcPtr, Tcl_Obj **objvPtr[]) { const char *flag; - assert(interp != NULL); - assert(obj != NULL); - assert(methodName != NULL); - assert(objcPtr != NULL); - assert(objvPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(obj != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(objcPtr != NULL); + nonnull_assert(objvPtr != NULL); if (obj->typePtr == Nsf_OT_listType) { if (Tcl_ListObjGetElements(interp, obj, objcPtr, objvPtr) == TCL_OK && *objcPtr > 1) { @@ -20907,10 +20925,10 @@ int result; Tcl_Obj *methodObj = Tcl_NewStringObj(methodName, -1); - assert(interp != NULL); - assert(object != NULL); - assert(initString != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(initString != NULL); + nonnull_assert(methodName != NULL); /* * When configure gets "-init" passed, we call "init" and notice the fact it @@ -20967,8 +20985,8 @@ IsRootNamespace(Tcl_Interp *interp, Tcl_Namespace *nsPtr) { NsfObjectSystem *osPtr; - assert(interp != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { Tcl_Command cmd = osPtr->rootClass->object.id; @@ -21003,7 +21021,7 @@ Tcl_CallFrame *framePtr; Tcl_Namespace *nsPtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); /*NsfShowStack(interp);*/ framePtr = CallStackGetActiveProcFrame((Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp)); @@ -21038,8 +21056,8 @@ static void ArgumentResetRefCounts(struct Nsf_Param const *pPtr, Tcl_Obj *valueObj) { - assert(pPtr != NULL); - assert(valueObj != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(valueObj != NULL); if ((pPtr->flags & NSF_ARG_IS_CONVERTER) != 0u) { DECR_REF_COUNT2("valueObj", valueObj); @@ -21071,12 +21089,12 @@ int objc, i, result; Tcl_Obj **ov; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(flags != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(flags != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); assert((pPtr->flags & NSF_ARG_MULTIVALUED) != 0u); assert(*flags & NSF_PC_MUST_DECR); @@ -21147,12 +21165,12 @@ unsigned int *flags, ClientData *clientData, Tcl_Obj **outObjPtr) { int result; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(flags != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(flags != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); /* * Default assumption: outObjPtr is not modified. @@ -21279,9 +21297,9 @@ Nsf_Param const *pPtr; int i; - assert(pcPtr != NULL); - assert(interp != NULL); - assert(ifd != NULL); + nonnull_assert(pcPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(ifd != NULL); for (pPtr = ifd, i = 0; i < nrParams; pPtr++, i++) { /*fprintf(stderr, "ArgumentDefaults got for arg %s (req %d, nrArgs %d) %p => %p %p, default '%s' \n", @@ -21449,10 +21467,10 @@ Nsf_Param const *paramPtr, int nrParams, int serial, unsigned int processFlags, Nsf_ParseContext *pcPtr) { - assert(interp != NULL); - assert(objv != NULL); - assert(procNameObj != NULL); - assert(pcPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(procNameObj != NULL); + nonnull_assert(pcPtr != NULL); return ArgumentParse(interp, objc, objv, (NsfObject *)object, procNameObj, paramPtr, nrParams, serial, processFlags, @@ -21480,8 +21498,8 @@ static Nsf_Param const * NextParam(Nsf_Param const *paramPtr, Nsf_Param const *lastParamPtr) { - assert(paramPtr != NULL); - assert(lastParamPtr != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(lastParamPtr != NULL); for (; (++paramPtr <= lastParamPtr) && (*paramPtr->name == '-'); ); return paramPtr; @@ -21515,11 +21533,11 @@ Nsf_Param const *currentParamPtr = paramPtr; Nsf_Param const *lastParamPtr = paramPtr + nrParams - 1; - assert(interp != NULL); - assert(objv != NULL); - assert(procNameObj != NULL); - assert(paramPtr != NULL); - assert(pcPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); + nonnull_assert(procNameObj != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(pcPtr != NULL); if ((processFlags & NSF_ARGPARSE_START_ZERO) != 0u) { fromArg = 0; @@ -21978,7 +21996,7 @@ ListVarKeys(Tcl_Interp *interp, Tcl_HashTable *tablePtr, const char *pattern) { Tcl_HashEntry *hPtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (pattern && NoMetaChars(pattern)) { Tcl_Obj *patternObj = Tcl_NewStringObj(pattern, -1); @@ -22031,7 +22049,7 @@ { Tcl_Command importedCmd; - assert(cmd != NULL); + nonnull_assert(cmd != NULL); while (1) { /* dereference the namespace import reference chain */ @@ -22071,9 +22089,9 @@ ListProcBody(Tcl_Interp *interp, Proc *procPtr, const char *methodName) { const char *body; - assert(interp != NULL); - assert(procPtr != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(procPtr != NULL); + nonnull_assert(methodName != NULL); body = ObjStr(procPtr->bodyPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(StripBodyPrefix(body), -1)); @@ -22104,8 +22122,8 @@ NsfParamsPrintStyle style) { Tcl_Obj *listObj; - assert(interp != NULL); - assert(paramsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramsPtr != NULL); switch (style) { case NSF_PARAMS_PARAMETER: listObj = ParamDefsFormat(interp, paramsPtr, contextObject, pattern); break; @@ -22146,9 +22164,9 @@ Tcl_Obj *listObj; Proc *procPtr; - assert(interp != NULL); - assert(methodName != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmd != NULL); paramDefs = ParamDefsGet(cmd, NULL); @@ -22320,9 +22338,9 @@ static void AppendForwardDefinition(Tcl_Interp *interp, Tcl_Obj *listObj, ForwardCmdClientData *tcd) { - assert(interp != NULL); - assert(listObj != NULL); - assert(tcd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(listObj != NULL); + nonnull_assert(tcd != NULL); if (tcd->prefix != NULL) { Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj("-prefix", -1)); @@ -22378,12 +22396,12 @@ NsfObject *object, const char *methodName, Tcl_Command cmd, int withObjFrame, int withPer_object, int withProtection) { - assert(interp != NULL); - assert(listObj != NULL); - assert(registerCmdName != NULL); - assert(object != NULL); - assert(methodName != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(listObj != NULL); + nonnull_assert(registerCmdName != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmd != NULL); Tcl_ListObjAppendElement(interp, listObj, object->cmdName); if (withProtection != 0) { @@ -22434,9 +22452,9 @@ AppendReturnsClause(Tcl_Interp *interp, Tcl_Obj *listObj, Tcl_Command cmd) { NsfParamDefs *paramDefs; - assert(interp != NULL); - assert(listObj != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(listObj != NULL); + nonnull_assert(cmd != NULL); paramDefs = ParamDefsGet(cmd, NULL); if (paramDefs && paramDefs->returns) { @@ -22488,10 +22506,11 @@ int outputPerObject; Tcl_Obj *resultObj; - assert(interp != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmd != NULL); + assert(*methodName != ':'); - assert(cmd != NULL); Tcl_ResetResult(interp); @@ -22914,8 +22933,8 @@ Tcl_DString ds, *dsPtr = &ds; Tcl_Command cmd; - assert(interp != NULL); - assert(methodNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodNameObj != NULL); Tcl_DStringInit(dsPtr); @@ -23012,10 +23031,10 @@ Tcl_ObjCmdProc *proc, *resolvedProc; Tcl_Command importedCmd; - assert(interp != NULL); - assert(cmd != NULL); - assert(methodName != NULL); - assert(isObject != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(isObject != NULL); proc = Tcl_Command_objProc(cmd); importedCmd = GetOriginalCommand(cmd); @@ -23089,7 +23108,7 @@ ProtectionMatches(int withCallprotection, Tcl_Command cmd) { int result, isProtected, isPrivate, cmdFlags; - assert(cmd != NULL); + nonnull_assert(cmd != NULL); cmdFlags = Tcl_Command_flags(cmd); isProtected = (cmdFlags & NSF_CMD_CALL_PROTECTED_METHOD) != 0u; @@ -23146,8 +23165,8 @@ int prefixLength = (prefix != NULL) ? Tcl_DStringLength(prefix) : 0; Tcl_Obj *resultObj = Tcl_GetObjResult(interp); - assert(interp != NULL); - assert(tablePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(tablePtr != NULL); if (pattern && NoMetaChars(pattern) && strchr(pattern, ' ') == NULL) { /* @@ -23340,8 +23359,8 @@ int classesOnly, NsfClass *type) { NsfObject *childObject; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->nsPtr == NULL) { return TCL_OK; @@ -23425,8 +23444,8 @@ ListForward(Tcl_Interp *interp, Tcl_HashTable *tablePtr, const char *pattern, int withDefinition) { - assert(interp != NULL); - assert(tablePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(tablePtr != NULL); if (withDefinition != 0) { Tcl_HashEntry *hPtr = (pattern != NULL) ? Tcl_CreateHashEntry(tablePtr, pattern, NULL) : NULL; @@ -23478,8 +23497,8 @@ Tcl_HashTable *cmdTablePtr; Tcl_DString ds, *dsPtr = NULL; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (pattern && *pattern == ':' && *(pattern + 1) == ':') { Namespace *nsPtr, *dummy1Ptr, *dummy2Ptr; @@ -23552,8 +23571,8 @@ ClientData clientData; int rc; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); if (cl->super == NULL) { return TCL_OK; @@ -23623,9 +23642,9 @@ static const char * AliasIndex(Tcl_DString *dsPtr, Tcl_Obj *cmdName, const char *methodName, int withPer_object) { - assert(dsPtr != NULL); - assert(cmdName != NULL); - assert(methodName != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(methodName != NULL); Tcl_DStringInit(dsPtr); Tcl_DStringAppend(dsPtr, ObjStr(cmdName), -1); @@ -23663,10 +23682,10 @@ const char *cmd) { Tcl_DString ds, *dsPtr = &ds; - assert(interp != NULL); - assert(cmdName != NULL); - assert(methodName != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmd != NULL); Tcl_SetVar2Ex(interp, NsfGlobalStrings[NSF_ARRAY_ALIAS], AliasIndex(dsPtr, cmdName, methodName, withPer_object), @@ -23700,9 +23719,9 @@ Tcl_DString ds, *dsPtr = &ds; int result; - assert(interp != NULL); - assert(cmdName != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(methodName != NULL); result = Tcl_UnsetVar2(interp, NsfGlobalStrings[NSF_ARRAY_ALIAS], AliasIndex(dsPtr, cmdName, methodName, withPer_object), @@ -23735,9 +23754,9 @@ Tcl_DString ds, *dsPtr = &ds; Tcl_Obj *obj; - assert(interp != NULL); - assert(cmdName != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(methodName != NULL); obj = Tcl_GetVar2Ex(interp, NsfGlobalStrings[NSF_ARRAY_ALIAS], AliasIndex(dsPtr, cmdName, methodName, withPer_object), @@ -23774,9 +23793,9 @@ AliasDeleteObjectReference(Tcl_Interp *interp, Tcl_Command cmd) { NsfObject *referencedObject = NsfGetObjectFromCmdPtr(cmd); - assert(interp != NULL); - assert(cmd != NULL); - assert(referencedObject != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cmd != NULL); + nonnull_assert(referencedObject != NULL); /*fprintf(stderr, "AliasDeleteObjectReference on %p obj %p\n", cmd, referencedObject);*/ if (referencedObject->refCount > 0 @@ -23816,10 +23835,10 @@ NsfObject *defObject; Tcl_Command cmd; - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); - assert(tcd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(tcd != NULL); defObject = (tcd->class != NULL) ? &(tcd->class->object) : object; @@ -23902,10 +23921,10 @@ NSF_INLINE static Tcl_Command AliasDereference(Tcl_Interp *interp, NsfObject *object, const char *methodName, Tcl_Command cmd) { - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); - assert(cmd != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); + nonnull_assert(cmd != NULL); if (unlikely(Tcl_Command_objProc(cmd) == NsfProcAliasMethod)) { AliasCmdClientData *tcd = (AliasCmdClientData *)Tcl_Command_objClientData(cmd); @@ -23936,11 +23955,11 @@ int withPer_object, NsfObject *regObject, Tcl_Obj *nameObj, Tcl_Obj *argumentsObj, Tcl_Obj *bodyObj) { - assert(interp != NULL); - assert(defObject != NULL); - assert(nameObj != NULL); - assert(argumentsObj != NULL); - assert(bodyObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(defObject != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(argumentsObj != NULL); + nonnull_assert(bodyObj != NULL); /* * Dummy stub; used, when compiled without NSF_ASSEMBLE @@ -23971,10 +23990,10 @@ SetBooleanFlag(Tcl_Interp *interp, unsigned int *flagsPtr, unsigned int flag, Tcl_Obj *valueObj, int *flagValue) { int result; - assert(interp != NULL); - assert(flagsPtr != NULL); - assert(valueObj != NULL); - assert(flagValue != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(flagsPtr != NULL); + nonnull_assert(valueObj != NULL); + nonnull_assert(flagValue != NULL); result = Tcl_GetBooleanFromObj(interp, valueObj, flagValue); if (unlikely(result != TCL_OK)) { @@ -24000,7 +24019,7 @@ static int NsfDebugCompileEpoch(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); Tcl_SetObjResult(interp, Tcl_NewIntObj(((Interp *)interp)->compileEpoch)); return TCL_OK; @@ -24016,8 +24035,8 @@ static int NsfDebugShowObj(Tcl_Interp *interp, Tcl_Obj *objPtr) { - assert(interp != NULL); - assert(objPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); fprintf(stderr, "*** obj %p refCount %d type <%s>\n", (void *)objPtr, objPtr->refCount, (objPtr->typePtr != NULL) ? objPtr->typePtr->name : ""); @@ -24051,7 +24070,7 @@ static int NsfShowStackCmd(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfShowStack(interp); return TCL_OK; @@ -24065,7 +24084,7 @@ NsfObjectSystem *osPtr; NsfCmdList *instances = NULL, *entry; - assert(interp != NULL); + nonnull_assert(interp != NULL); /* * Collect all instances from all object systems. @@ -24134,7 +24153,7 @@ static int NsfProfileClearDataStub(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); #if defined(NSF_PROFILE) NsfProfileClearData(interp); @@ -24150,7 +24169,7 @@ static int NsfProfileGetDataStub(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); #if defined(NSF_PROFILE) NsfProfileGetData(interp); @@ -24174,7 +24193,7 @@ static int NsfProfileTraceStub(Tcl_Interp *interp, int withEnable, int withVerbose, int withDontsave, Tcl_Obj *builtins) { - assert(interp != NULL); + nonnull_assert(interp != NULL); #if defined(NSF_PROFILE) NsfProfileTrace(interp, withEnable, withVerbose, withDontsave, builtins); @@ -24207,7 +24226,7 @@ CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); Proc *proc = Tcl_CallFrame_procPtr(varFramePtr); - assert(interp != NULL); + nonnull_assert(interp != NULL); if (likely(proc != NULL)) { CompiledLocal *ap; @@ -24246,10 +24265,10 @@ static int NsfAsmProcCmd(Tcl_Interp *interp, int with_ad, int with_checkAlways, Tcl_Obj *nameObj, Tcl_Obj *arguments, Tcl_Obj *body) { - assert(interp != NULL); - assert(nameObj != NULL); - assert(arguments != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(arguments != NULL); + nonnull_assert(body != NULL); return TCL_OK; } @@ -24259,10 +24278,10 @@ NsfParsedParam parsedParam; int result; - assert(interp != NULL); - assert(nameObj != NULL); - assert(arguments != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(arguments != NULL); + nonnull_assert(body != NULL); /* * Parse argument list "arguments" to determine if we should provide @@ -24303,8 +24322,8 @@ static int NsfCmdInfoCmd(Tcl_Interp *interp, int subcmd, NsfObject *context, Tcl_Obj *methodNameObj, const char *pattern) { - assert(interp != NULL); - assert(methodNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodNameObj != NULL); return ListMethodResolve(interp, subcmd, context, pattern, NULL, NULL, methodNameObj, 0); } @@ -24319,7 +24338,7 @@ NsfConfigureCmd(Tcl_Interp *interp, int configureoption, Tcl_Obj *valueObj) { int bool; - assert(interp != NULL); + nonnull_assert(interp != NULL); #if defined(NSF_DTRACE) if (NSF_DTRACE_CONFIGURE_PROBE_ENABLED()) { @@ -24478,7 +24497,7 @@ const char *methodName = ObjStr(nobjv[0]); NsfObject *self = GetSelfObj(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); if (unlikely(self == NULL)) { return NsfNoCurrentObjectError(interp, methodName); @@ -24562,9 +24581,9 @@ unsigned int flags = 0; int useCmdDispatch = 1; - assert(interp != NULL); - assert(object != NULL); - assert(commandObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(commandObj != NULL); /*fprintf(stderr, "NsfDirectDispatchCmd obj=%s, cmd m='%s' oc %d\n", ObjectName(object), methodName, nobjc);*/ @@ -24672,9 +24691,9 @@ unsigned int flags = NSF_CM_NO_UNKNOWN|NSF_CSC_IMMEDIATE|NSF_CM_IGNORE_PERMISSIONS|NSF_CM_NO_SHIFT; Tcl_Obj *CONST*objv = nobjv-1; - assert(interp != NULL); - assert(object != NULL); - assert(commandObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(commandObj != NULL); /* * We use the construct tclObj + args in the spec to enforce that at least a @@ -24731,7 +24750,7 @@ NsfFinalizeCmd(Tcl_Interp *interp, int withKeepvars) { int result; - assert(interp != NULL); + nonnull_assert(interp != NULL); #if defined(NSF_PROFILE) /* @@ -24800,8 +24819,8 @@ static int NsfInterpObjCmd(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *CONST objv[]) { - assert(interp != NULL); - assert(name != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(name != NULL); /* create a fresh Tcl interpreter, or pass command to an existing one */ if (unlikely(NsfCallCommand(interp, NSF_INTERP, objc, objv) != TCL_OK)) { @@ -24854,9 +24873,9 @@ Nsf_Param *paramPtr = NULL; int result; - assert(interp != NULL); - assert(constraintObj != NULL); - assert(valueObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(constraintObj != NULL); + nonnull_assert(valueObj != NULL); result = ParameterCheck(interp, constraintObj, valueObj, (name != NULL) ? name : "value:", 1, @@ -24911,11 +24930,11 @@ NsfClass *cl = (withPer_object || ! NsfObjectIsClass(object)) ? NULL : (NsfClass *)object; NsfObject *oldTargetObject, *newTargetObject; - assert(interp != NULL); - assert(object != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodName != NULL); assert(*methodName != ':'); - assert(cmdName != NULL); + nonnull_assert(cmdName != NULL); cmd = Tcl_GetCommandFromObj(interp, cmdName); if (cmd == NULL) { @@ -25112,8 +25131,8 @@ #if defined(NSF_WITH_ASSERTIONS) NsfClass *class; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); switch (subcmd) { case AssertionsubcmdCheckIdx: @@ -25179,11 +25198,11 @@ (withPer_object || ! NsfObjectIsClass(defObject)) ? NULL : (NsfClass *)defObject; - assert(interp != NULL); - assert(defObject != NULL); - assert(nameObj != NULL); - assert(arguments != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(defObject != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(arguments != NULL); + nonnull_assert(body != NULL); if (cl == NULL) { RequireObjNamespace(interp, defObject); @@ -25211,9 +25230,9 @@ Tcl_DString ds, *dsPtr = &ds; Tcl_Command cmd; - assert(interp != NULL); - assert(object != NULL); - assert(methodNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodNameObj != NULL); Tcl_DStringInit(dsPtr); @@ -25278,9 +25297,9 @@ ForwardCmdClientData *tcd = NULL; int result; - assert(interp != NULL); - assert(object != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObj != NULL); result = ForwardProcessOptions(interp, methodObj, withDefault, withEarlybinding, @@ -25336,9 +25355,9 @@ NsfClass *cl; int fromClassNS; - assert(interp != NULL); - assert(object != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObj != NULL); cl = withPer_object == 0 && NsfObjectIsClass(object) ? (NsfClass *)object : NULL; fromClassNS = cl != NULL; @@ -25413,9 +25432,9 @@ int fromClassNS = cl != NULL; unsigned int flag; - assert(interp != NULL); - assert(object != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObj != NULL); cmd = ResolveMethodName(interp, (cl != NULL) ? cl->nsPtr : object->nsPtr, methodObj, NULL, NULL, &defObject, NULL, &fromClassNS); @@ -25553,8 +25572,8 @@ int fromClassNS = 0; Tcl_Command cmd; - assert(interp != NULL); - assert(methodNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodNameObj != NULL); cmd = ResolveMethodName(interp, NULL, methodNameObj, NULL, ®Object, NULL, NULL, &fromClassNS); @@ -25584,9 +25603,9 @@ size_t j, length; int result; - assert(interp != NULL); - assert(object != NULL); - assert(parameter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(parameter != NULL); if (unlikely(*methodName == '-' || *methodName == ':')) { return NsfPrintError(interp, "invalid setter name \"%s\" (must not start with a dash or colon)", @@ -25653,9 +25672,9 @@ Tcl_Obj *newNameObj = NULL; int result; - assert(interp != NULL); - assert(class != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(nameObj != NULL); /* * If the provided name is empty, make a new symbol @@ -25714,8 +25733,8 @@ NsfObjectExistsCmd(Tcl_Interp *interp, Tcl_Obj *valueObj) { NsfObject *object; - assert(interp != NULL); - assert(valueObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(valueObj != NULL); /* * Pass the object as Tcl_Obj, since we do not want to raise an error in @@ -25737,8 +25756,8 @@ NsfObjectPropertyCmd(Tcl_Interp *interp, NsfObject *object, int objectproperty, Tcl_Obj *valueObj) { unsigned int flags = 0u, allowSet = 0u; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); switch (objectproperty) { case ObjectpropertyInitializedIdx: flags = NSF_INIT_CALLED; allowSet = 1; break; @@ -25769,7 +25788,7 @@ } if (objectproperty == ObjectpropertySlotcontainerIdx) { - assert(object->nsPtr); + assert(object->nsPtr != NULL); if (flagValue != 0) { /* turn on SlotContainerCmdResolver */ Tcl_SetNamespaceResolvers(object->nsPtr, @@ -25805,8 +25824,8 @@ NsfObjectQualifyCmd(Tcl_Interp *interp, Tcl_Obj *nameObj) { const char *nameString = ObjStr(nameObj); - assert(interp != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); if (isAbsolutePath(nameString)) { Tcl_SetObjResult(interp, nameObj); @@ -25831,9 +25850,9 @@ const char *className = ObjStr(Class); NsfObjectSystem *osPtr; - assert(interp != NULL); - assert(Object); - assert(Class); + nonnull_assert(interp != NULL); + nonnull_assert(Object != NULL); + nonnull_assert(Class != NULL); osPtr = NEW(NsfObjectSystem); memset(osPtr, 0, sizeof(NsfObjectSystem)); @@ -25964,8 +25983,8 @@ unsigned int flags; int result; - assert(interp != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodObj != NULL); if (unlikely(self == NULL)) { return NsfNoCurrentObjectError(interp, method_definitions[NsfMyCmdIdx].methodName); @@ -26032,7 +26051,7 @@ const char *methodName = NULL; Tcl_Obj **nobjv = NULL, **ov; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (arguments != NULL) { /* Arguments were provided. */ @@ -26073,9 +26092,9 @@ Tcl_Obj *varNameObj = NULL; int result; - assert(interp != NULL); - assert(fromNs != NULL); - assert(toNs != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(fromNs != NULL); + nonnull_assert(toNs != NULL); TclGetNamespaceFromObj(interp, fromNs, &fromNsPtr); @@ -26200,8 +26219,8 @@ Nsf_Param *paramsPtr; int result; - assert(interp != NULL); - assert(parameterspec != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(parameterspec != NULL); if (parametersubcmd != ParametersubcmdDefaultIdx && varname != NULL) { return NsfPrintError(interp, "parameter::info: provided third argument is only valid for querying defaults"); @@ -26313,8 +26332,8 @@ static int NsfParameterCacheClassInvalidateCmd(Tcl_Interp *interp, NsfClass *cl) { - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); /* * First, increment the epoch in case we have a parsedParam. The @@ -26370,8 +26389,8 @@ static int NsfParameterCacheObjectInvalidateCmd(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #if defined(PER_OBJECT_PARAMETER_CACHING) if (object->opt != NULL && object->opt->parsedParamPtr) { @@ -26398,8 +26417,8 @@ Tcl_Obj **objv, *resultObj; int result = TCL_OK, i, objc; - assert(interp != NULL); - assert(slotListObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(slotListObj != NULL); if (Tcl_ListObjGetElements(interp, slotListObj, &objc, &objv) != TCL_OK) { return NsfPrintError(interp, "NsfParameterSpecsCmd: invalid slot object list"); @@ -26505,10 +26524,10 @@ NsfParsedParam parsedParam; int result; - assert(interp != NULL); - assert(nameObj != NULL); - assert(arguments != NULL); - assert(body != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(arguments != NULL); + nonnull_assert(body != NULL); /* * Parse argument list "arguments" to determine if we should provide @@ -26583,9 +26602,9 @@ NsfClassOpt *clopt; int i; - assert(interp != NULL); - assert(cl != NULL); - assert(valueObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(valueObj != NULL); for (i = 0; i < oc; i++) { if (unlikely(MixinAdd(interp, &newMixinCmdList, ov[i], cl->object.cl) != TCL_OK)) { @@ -26653,8 +26672,8 @@ NsfClassOpt *clopt = NULL, *nclopt = NULL; int i; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /*fprintf(stderr, "NsfRelationSetCmd %s rel=%d val='%s'\n", ObjectName(object), relationtype, (valueObj != NULL) ? ObjStr(valueObj) : "NULL");*/ @@ -26913,7 +26932,7 @@ Tcl_CallFrame *framePtr; int result = TCL_OK; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (selfoption == 0 || selfoption == CurrentoptionObjectIdx) { if (likely(object != NULL)) { @@ -27074,7 +27093,7 @@ NsfSelfCmd(Tcl_Interp *interp) { NsfObject *object = GetSelfObj(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); if (likely(object != NULL)) { Tcl_SetObjResult(interp, object->cmdName); @@ -27097,9 +27116,9 @@ NSF_VAR_TRIGGER_TRACE|NSF_VAR_REQUIRE_DEFINED| ((withArray != 0) ? NSF_VAR_ISARRAY : 0); - assert(interp != NULL); - assert(object != NULL); - assert(varName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(varName != NULL); if (unlikely(CheckVarName(interp, varName) != TCL_OK)) { return TCL_ERROR; @@ -27135,10 +27154,10 @@ NsfVarImport(Tcl_Interp *interp, NsfObject *object, const char *cmdName, int objc, Tcl_Obj *CONST objv[]) { int i, result = TCL_OK; - assert(interp != NULL); - assert(object != NULL); - assert(cmdName != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(cmdName != NULL); + nonnull_assert(objv != NULL); for (i = 0; i < objc && result == TCL_OK; i++) { Tcl_Obj **ov; @@ -27167,8 +27186,8 @@ static int NsfVarImportCmd(Tcl_Interp *interp, NsfObject *object, int objc, Tcl_Obj *CONST objv[]) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return NsfVarImport(interp, object, "importvar", objc, objv); } @@ -27185,9 +27204,9 @@ NsfVarSetCmd(Tcl_Interp *interp, int withArray, NsfObject *object, Tcl_Obj *varName, Tcl_Obj *valueObj) { - assert(interp != NULL); - assert(object != NULL); - assert(varName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(varName != NULL); if (unlikely(CheckVarName(interp, ObjStr(varName)) != TCL_OK)) { return TCL_ERROR; @@ -27210,9 +27229,9 @@ NsfVarUnsetCmd(Tcl_Interp *interp, int withNocomplain, NsfObject *object, Tcl_Obj *varNameObj) { const char *varName = ObjStr(varNameObj); - assert(interp != NULL); - assert(object != NULL); - assert(varNameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(varNameObj != NULL); if (unlikely(CheckVarName(interp, varName) != TCL_OK)) { return TCL_ERROR; @@ -27248,14 +27267,14 @@ static void ParamUpdateString(Tcl_Obj *objPtr) { - assert(objPtr != NULL); + nonnull_assert(objPtr != NULL); Tcl_Panic("%s of type %s should not be called", "updateStringProc", objPtr->typePtr->name); } static void ParamDupInteralRep(Tcl_Obj *srcPtr, Tcl_Obj *UNUSED(dupPtr)) { - assert(srcPtr != NULL); + nonnull_assert(srcPtr != NULL); Tcl_Panic("%s of type %s should not be called", "dupStringProc", srcPtr->typePtr->name); } @@ -27275,7 +27294,7 @@ { NsfParamWrapper *paramWrapperPtr = (NsfParamWrapper *)objPtr->internalRep.twoPtrValue.ptr1; - assert(objPtr != NULL); + nonnull_assert(objPtr != NULL); if (paramWrapperPtr != NULL) { /* fprintf(stderr, "ParamFreeInternalRep freeing wrapper %p paramPtr %p refCount %dcanFree %d\n", paramWrapperPtr, paramWrapperPtr->paramPtr, paramWrapperPtr->refCount, @@ -27319,9 +27338,9 @@ int result, possibleUnknowns = 0, plainParams = 0, nrNonposArgs = 0; NsfParamWrapper *paramWrapperPtr = NEW(NsfParamWrapper); - assert(interp != NULL); - assert(varNamePrefix != NULL); - assert(objPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(varNamePrefix != NULL); + nonnull_assert(objPtr != NULL); paramWrapperPtr->paramPtr = ParamsNew(1); paramWrapperPtr->refCount = 1; @@ -27370,8 +27389,8 @@ Tcl_Interp *interp, /* Used for error reporting if not NULL. */ register Tcl_Obj *objPtr) /* The object to convert. */ { - assert(interp != NULL); - assert(objPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); return ParamSetFromAny2(interp, "value:", 0, objPtr); } @@ -27466,9 +27485,9 @@ NsfParsedParam *parsedParamPtr) { int result = TCL_OK; - assert(interp != NULL); - assert(procNameObj != NULL); - assert(parsedParamPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(procNameObj != NULL); + nonnull_assert(parsedParamPtr != NULL); parsedParamPtr->paramDefs = NULL; parsedParamPtr->possibleUnknowns = 0; @@ -27574,9 +27593,9 @@ int result; unsigned int flags = 0u; - assert(interp != NULL); - assert(paramObjPtr != NULL); - assert(valueObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(paramObjPtr != NULL); + nonnull_assert(valueObj != NULL); /*fprintf(stderr, "ParameterCheck %s value %p %s\n", ObjStr(paramObjPtr), valueObj, ObjStr(valueObj));*/ @@ -27634,9 +27653,9 @@ Tcl_Obj *nameObj) { Tcl_Obj *autonamedObj; - assert(interp != NULL); - assert(object != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(nameObj != NULL); autonamedObj = AutonameIncr(interp, nameObj, object, withInstance, withReset); if (autonamedObj != NULL) { @@ -27656,8 +27675,8 @@ static int NsfOClassMethod(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *classObj) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return NsfRelationSetCmd(interp, object, RelationtypeClassIdx, classObj); } @@ -27672,8 +27691,8 @@ Tcl_Obj *savedNameObj; int softrecreate; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #if defined(OBJDELETION_TRACE) fprintf(stderr, "+++ NsfOCleanupMethod\n"); @@ -27712,8 +27731,8 @@ GetSlotObject(Tcl_Interp *interp, Tcl_Obj *slotObj) { NsfObject *slotObject = NULL; - assert(interp != NULL); - assert(slotObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(slotObj != NULL); if (unlikely(GetObjectFromObj(interp, slotObj, &slotObject) != TCL_OK || slotObject == NULL)) { NsfPrintError(interp, "couldn't resolve slot object %s", ObjStr(slotObj)); @@ -27734,9 +27753,9 @@ ParseContext pc; CallFrame frame, *framePtr = &frame, *uplevelVarFramePtr; - assert(interp != NULL); - assert(object != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(objv != NULL); #if 0 fprintf(stderr, "NsfOConfigureMethod %s.%s flags %.6x oc %2d", ObjectName(object), ObjStr(objv0), object->flags, objc); @@ -28088,9 +28107,9 @@ CallFrame frame, *framePtr = &frame, *uplevelVarFramePtr; const char *nameString = ObjStr(nameObj); - assert(interp != NULL); - assert(object != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(nameObj != NULL); /* * Get the object parameter definition @@ -28243,8 +28262,8 @@ NsfODestroyMethod(Tcl_Interp *interp, NsfObject *object) { PRINTOBJ("NsfODestroyMethod", object); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /* * Provide protection against destroy on base classes. @@ -28315,9 +28334,9 @@ static int NsfOExistsMethod(Tcl_Interp *interp, NsfObject *object, const char *var) { - assert(interp != NULL); - assert(object != NULL); - assert(var != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(var != NULL); Tcl_SetIntObj(Tcl_GetObjResult(interp), VarExists(interp, object, var, NULL, @@ -28336,10 +28355,10 @@ NsfOFilterGuardMethod(Tcl_Interp *interp, NsfObject *object, const char *filter, Tcl_Obj *guardObj) { NsfObjectOpt *opt; - assert(interp != NULL); - assert(object != NULL); - assert(filter != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(filter != NULL); + nonnull_assert(guardObj != NULL); opt = object->opt; if (opt != NULL && opt->objFilters) { @@ -28369,8 +28388,8 @@ callFrameContext ctx = {0, NULL, NULL}; int result; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->filterStack || object->mixinStack) { CallStackUseActiveFrame(interp, &ctx); @@ -28399,10 +28418,10 @@ NsfOMixinGuardMethod(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *mixin, Tcl_Obj *guardObj) { NsfObjectOpt *opt; - assert(interp != NULL); - assert(object != NULL); - assert(mixin != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(mixin != NULL); + nonnull_assert(guardObj != NULL); opt = object->opt; if (opt != NULL && opt->objMixins) { @@ -28434,7 +28453,7 @@ static int NsfONoinitMethod(Tcl_Interp *UNUSED(interp), NsfObject *object) { - assert(object != NULL); + nonnull_assert(object != NULL); object->flags |= NSF_INIT_CALLED; return TCL_OK; @@ -28447,8 +28466,8 @@ static int NsfORequireNamespaceMethod(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); RequireObjNamespace(interp, object); return TCL_OK; @@ -28465,8 +28484,8 @@ const char *methodName, *nextMethodName, *initString = NULL; Tcl_Obj **argv, **nextArgv; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); #if 0 fprintf(stderr, "NsfOResidualargsMethod %s %2d ", ObjectName(object), objc); @@ -28578,8 +28597,8 @@ int i, result = TCL_ERROR; Tcl_CallFrame *framePtr = NULL, *savedVarFramePtr; - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); /* * Find the level to use for executing the command. @@ -28655,8 +28674,8 @@ const char *frameInfo; callFrameContext ctx = {0, NULL, NULL}; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (objc % 2 == 0) { frameInfo = ObjStr(objv[1]); @@ -28698,8 +28717,8 @@ const char *fullName, *vn; callFrameContext ctx = {0, NULL, NULL}; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (unlikely(RUNTIME_STATE(interp)->exitHandlerDestroyRound != NSF_EXITHANDLER_OFF)) { return NsfPrintError(interp, "can't make objects volatile during shutdown"); @@ -28744,9 +28763,9 @@ const char *nameString = ObjStr(nameObj); NsfObject *newObj; - assert(interp != NULL); - assert(cl != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(nameObj != NULL); assert(isAbsolutePath(nameString)); assert(NSValidObjectName(nameString, 0)); @@ -28792,9 +28811,9 @@ Tcl_Obj *tmpName; int result; - assert(interp != NULL); - assert(cl != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(nameObj != NULL); /* * Create a new object from scratch. @@ -28847,10 +28866,10 @@ const char *nameString = ObjStr(specifiedNameObj); Tcl_Namespace *parentNsPtr; - assert(interp != NULL); - assert(cl != NULL); - assert(specifiedNameObj != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(specifiedNameObj != NULL); + nonnull_assert(objv != NULL); #if 0 { int i; @@ -29032,7 +29051,7 @@ NsfCDeallocMethod(Tcl_Interp *interp, NsfClass *UNUSED(cl), Tcl_Obj *obj) { NsfObject *object; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (GetObjectFromObj(interp, obj, &object) != TCL_OK) { return NsfPrintError(interp, "can't destroy object %s that does not exist", @@ -29054,10 +29073,10 @@ const char *filter, Tcl_Obj *guardObj) { NsfClassOpt *opt; - assert(interp != NULL); - assert(cl != NULL); - assert(filter != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(filter != NULL); + nonnull_assert(guardObj != NULL); opt = cl->opt; if (opt != NULL && opt->classFilters) { @@ -29091,8 +29110,8 @@ static int NsfCGetCachendParametersMethod(Tcl_Interp *interp, NsfClass *class) { - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); if (likely(class->parsedParamPtr != NULL && class->parsedParamPtr->paramDefs != NULL)) { Tcl_Obj *listObj; @@ -29115,10 +29134,10 @@ NsfCMixinGuardMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *mixin, Tcl_Obj *guardObj) { NsfClassOpt *opt; - assert(interp != NULL); - assert(cl != NULL); - assert(mixin != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(mixin != NULL); + nonnull_assert(guardObj != NULL); opt = cl->opt; if (opt != NULL && opt->classMixins != NULL) { @@ -29164,8 +29183,8 @@ Tcl_DString dFullname, *dsPtr = &dFullname; int result; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); #if 0 { int i; @@ -29253,10 +29272,10 @@ int objc, Tcl_Obj *CONST objv[]) { int result; - assert(interp != NULL); - assert(class != NULL); - assert(object != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(object != NULL); + nonnull_assert(objv != NULL); object->flags |= NSF_RECREATE; @@ -29314,9 +29333,9 @@ int objc, Tcl_Obj *CONST objv[]) { NsfObject *object; - assert(interp != NULL); - assert(cl != NULL); - assert(nameObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); + nonnull_assert(nameObj != NULL); if (GetObjectFromObj(interp, nameObj, &object) != TCL_OK) { return NsfPrintError(interp, "can't recreate non existing object %s", ObjStr(nameObj)); @@ -29332,8 +29351,8 @@ static int NsfCSuperclassMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *superClassesObj) { - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); return NsfRelationSetCmd(interp, &cl->object, RelationtypeSuperclassIdx, superClassesObj); } @@ -29391,8 +29410,8 @@ static int NsfObjInfoChildrenMethod(Tcl_Interp *interp, NsfObject *object, NsfClass *type, const char *pattern) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return ListChildren(interp, object, pattern, 0, type); } @@ -29404,8 +29423,8 @@ static int NsfObjInfoClassMethod(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); Tcl_SetObjResult(interp, object->cl->object.cmdName); return TCL_OK; @@ -29419,9 +29438,9 @@ static int NsfObjInfoFilterguardMethod(Tcl_Interp *interp, NsfObject *object, const char *filter) { - assert(interp != NULL); - assert(object != NULL); - assert(filter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(filter != NULL); return (object->opt != NULL) ? GuardList(interp, object->opt->objFilters, filter) : TCL_OK; } @@ -29437,8 +29456,8 @@ const char *pattern) { NsfObjectOpt *opt; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); opt = object->opt; return (opt != NULL) ? FilterInfo(interp, opt->objFilters, pattern, withGuards, 0) : TCL_OK; @@ -29453,8 +29472,8 @@ static int NsfObjInfoForwardMethod(Tcl_Interp *interp, NsfObject *object, int withDefinition, const char *pattern) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return (object->nsPtr != NULL) ? ListForward(interp, Tcl_Namespace_cmdTablePtr(object->nsPtr), pattern, withDefinition) : @@ -29469,9 +29488,9 @@ static int NsfObjInfoHasMixinMethod(Tcl_Interp *interp, NsfObject *object, NsfClass *mixinClass) { - assert(interp != NULL); - assert(object != NULL); - assert(mixinClass != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(mixinClass != NULL); Tcl_SetBooleanObj(Tcl_GetObjResult(interp), HasMixin(interp, object, mixinClass)); return TCL_OK; @@ -29484,8 +29503,8 @@ static int NsfObjInfoHasnamespaceMethod(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); Tcl_SetBooleanObj(Tcl_GetObjResult(interp), object->nsPtr != NULL); return TCL_OK; @@ -29499,9 +29518,9 @@ static int NsfObjInfoHasTypeMethod(Tcl_Interp *interp, NsfObject *object, NsfClass *typeClass) { - assert(interp != NULL); - assert(object != NULL); - assert(typeClass != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(typeClass != NULL); Tcl_SetBooleanObj(Tcl_GetObjResult(interp), IsSubType(object->cl, typeClass)); return TCL_OK; @@ -29518,9 +29537,9 @@ NsfCmdList *cmdList; NsfClass *fcl; - assert(interp != NULL); - assert(object != NULL); - assert(filter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(filter != NULL); /* * Searches for filter on [self] and returns fully qualified name if it is @@ -29559,8 +29578,8 @@ static int NsfObjInfoLookupFiltersMethod(Tcl_Interp *interp, NsfObject *object, int withGuards, const char *pattern) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if ((object->flags & NSF_FILTER_ORDER_VALID) == 0u) { FilterComputeDefined(interp, object); @@ -29578,9 +29597,9 @@ NsfClass *pcl = NULL; Tcl_Command cmd; - assert(interp != NULL); - assert(object != NULL); - assert(methodObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(methodObj != NULL); cmd = ObjectFindMethod(interp, object, methodObj, &pcl); if (likely(cmd != NULL)) { @@ -29619,9 +29638,9 @@ int methodType, int withCallprotection, int withPath, Tcl_HashTable *dups, NsfObject *object, int withPer_object) { - assert(interp != NULL); - assert(dups != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(dups != NULL); + nonnull_assert(object != NULL); /* append method keys from inheritance order */ for (; classListPtr != NULL; classListPtr = classListPtr->nextPtr) { @@ -29662,8 +29681,8 @@ Tcl_HashTable dupsTable, *dups = &dupsTable; int result, methodType = AggregatedMethodType(withMethodtype); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /* * TODO: we could make this faster for patterns without meta-chars @@ -29736,8 +29755,8 @@ static int NsfObjInfoLookupMixinsMethod(Tcl_Interp *interp, NsfObject *object, int withGuards, const char *patternString, NsfObject *patternObj) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if ((object->flags & NSF_MIXIN_ORDER_VALID) == 0u) { MixinComputeDefined(interp, object); @@ -29761,8 +29780,8 @@ NsfClasses *precendenceList, *clPtr; Tcl_HashTable slotTable; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); precendenceList = ComputePrecedenceList(interp, object, NULL /* pattern*/, 1, 1); assert(precendenceList != NULL); @@ -29826,8 +29845,8 @@ int withPath, const char *pattern) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return ListDefinedMethods(interp, object, pattern, 1 /* per-object */, AggregatedMethodType(withMethodtype), withCallproctection, @@ -29843,8 +29862,8 @@ static int NsfObjInfoMixinsMethod(Tcl_Interp *interp, NsfObject *object, int withGuards, const char *patternString, NsfObject *patternObj) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); return (object->opt != NULL) ? MixinInfo(interp, object->opt->objMixins, patternString, withGuards, patternObj) : @@ -29859,9 +29878,9 @@ static int NsfObjInfoMixinguardMethod(Tcl_Interp *interp, NsfObject *object, const char *mixin) { - assert(interp != NULL); - assert(object != NULL); - assert(mixin != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(mixin != NULL); return (object->opt != NULL) ? GuardList(interp, object->opt->objMixins, mixin) : TCL_OK; } @@ -29873,8 +29892,8 @@ static int NsfObjInfoNameMethod(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetCommandName(interp, object->id), -1)); return TCL_OK; @@ -29897,8 +29916,8 @@ Nsf_Param *paramList = NULL; int result; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], object, NULL, &parsedParam); @@ -29955,8 +29974,8 @@ static int NsfObjInfoParentMethod(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); if (object->id != NULL) { Tcl_Namespace *nsPtr = Tcl_Command_nsPtr(object->id); @@ -29977,8 +29996,8 @@ NsfClasses *precedenceList, *pl; Tcl_Obj *resultObj = Tcl_NewObj(); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); precedenceList = ComputePrecedenceList(interp, object, pattern, !withIntrinsicOnly, 1); for (pl = precedenceList; pl; pl = pl->nextPtr) { @@ -30004,8 +30023,8 @@ NsfClass *type, const char *pattern) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); AddSlotObjects(interp, object, "::per-object-slot", NULL, SourceAllIdx, type, pattern, listObj); @@ -30026,8 +30045,8 @@ int i, length; TclVarHashTable *varTablePtr; - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); varTablePtr = (object->nsPtr != NULL) ? Tcl_Namespace_varTablePtr(object->nsPtr) : @@ -30066,9 +30085,9 @@ static int NsfClassInfoFilterguardMethod(Tcl_Interp *interp, NsfClass *class, const char *filter) { - assert(interp != NULL); - assert(class != NULL); - assert(filter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(filter != NULL); return (class->opt != NULL) ? GuardList(interp, class->opt->classFilters, filter) : TCL_OK; } @@ -30083,8 +30102,8 @@ NsfClassInfoFiltersMethod(Tcl_Interp *interp, NsfClass *class, int withGuards, const char *pattern) { - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); return (class->opt != NULL) ? FilterInfo(interp, class->opt->classFilters, pattern, withGuards, 0) : TCL_OK; } @@ -30099,8 +30118,8 @@ NsfClassInfoForwardMethod(Tcl_Interp *interp, NsfClass *class, int withDefinition, const char *pattern) { - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); return ListForward(interp, Tcl_Namespace_cmdTablePtr(class->nsPtr), pattern, withDefinition); } @@ -30115,8 +30134,8 @@ NsfClasses *pl, *intrinsic, *checkList = NULL, *mixinClasses = NULL; Tcl_Obj *resultObj; - assert(interp != NULL); - assert(cl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cl != NULL); resultObj = Tcl_NewObj(); intrinsic = PrecedenceOrder(cl); @@ -30173,8 +30192,8 @@ const char *pattern, NsfObject *matchObject) { Tcl_Obj *resultObj = Tcl_NewObj(); - assert(interp != NULL); - assert(subClasses != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(subClasses != NULL); do { Tcl_HashTable *tablePtr = &subClasses->cl->instances; @@ -30208,8 +30227,8 @@ int withClosure, const char *pattern, NsfObject *matchObject) { NsfClasses clElement, *subClasses; - assert(interp != NULL); - assert(startCl != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(startCl != NULL); if (withClosure != 0) { subClasses = TransitiveSubClasses(startCl); @@ -30260,8 +30279,8 @@ int withSource, const char *pattern) { - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); if (withClosure != 0) { NsfClasses *checkList = NULL, *mixinClasses = NULL; @@ -30324,8 +30343,8 @@ Tcl_Obj *resultObj; int result = TCL_OK; - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); opt = class->opt; Tcl_ResetResult(interp); @@ -30383,9 +30402,9 @@ static int NsfClassInfoMixinguardMethod(Tcl_Interp *interp, NsfClass *class, const char *mixin) { - assert(interp != NULL); - assert(class != NULL); - assert(mixin != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); + nonnull_assert(mixin != NULL); return (class->opt != NULL) ? GuardList(interp, class->opt->classMixins, mixin) : TCL_OK; } @@ -30404,8 +30423,8 @@ int perClass, perObject, rc = TCL_OK; Tcl_Obj *resultObj; - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); opt = class->opt; Tcl_ResetResult(interp); @@ -30475,8 +30494,8 @@ Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); Tcl_HashTable slotTable; - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); Tcl_ResetResult(interp); intrinsicClasses = PrecedenceOrder(class); @@ -30551,8 +30570,8 @@ const char *patternString, NsfObject *patternObj) { int rc = 0; - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); if (withClosure && withDependent) { return NsfPrintError(interp, "only -closure or -dependent can be specified, not both"); @@ -30585,8 +30604,8 @@ static int NsfClassInfoSuperclassMethod(Tcl_Interp *interp, NsfClass *class, int withClosure, Tcl_Obj *pattern) { - assert(interp != NULL); - assert(class != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(class != NULL); return ListSuperClasses(interp, class, pattern, withClosure); } @@ -30612,8 +30631,8 @@ Var *varPtr; register Tcl_HashEntry *entryPtr; - assert(interp != NULL); - assert(nsPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nsPtr != NULL); /* fprintf(stderr, "DeleteProcsAndVars in %s\n", nsPtr->fullName); */ @@ -30678,8 +30697,8 @@ static void FinalObjectDeletion(Tcl_Interp *interp, NsfObject *object) { - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); /* * If a call to exit happens from a higher stack frame, the object @@ -30747,13 +30766,13 @@ register Tcl_HashEntry *entryPtr; Tcl_HashSearch search; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (nsPtr == NULL) { nsPtr = Tcl_GetGlobalNamespace(interp); } - assert(nsPtr != NULL); + nonnull_assert(nsPtr != NULL); /*fprintf(stderr, "### DeleteNsfProcs current namespace '%s'\n", (nsPtr != NULL) ? nsPtr->fullName : "NULL");*/ cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); @@ -30797,7 +30816,7 @@ static int ClassHasSubclasses(NsfClass *cl) { - assert(cl != NULL); + nonnull_assert(cl != NULL); return (cl->sub != NULL); } @@ -30823,7 +30842,7 @@ ClassHasInstances(NsfClass *cl) { Tcl_HashSearch hSrch; - assert(cl != NULL); + nonnull_assert(cl != NULL); return (Tcl_FirstHashEntry(&cl->instances, &hSrch) != NULL); } @@ -30850,7 +30869,7 @@ Tcl_Namespace *ns; int result = 0; - assert(object != NULL); + nonnull_assert(object != NULL); ns = object->nsPtr; if (ns != NULL) { @@ -30895,8 +30914,8 @@ NsfCmdList *entry, *lastEntry; int deleted = 0; - assert(interp != NULL); - assert(instances != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(instances != NULL); /*fprintf(stderr, "FreeAllNsfObjectsAndClasses in %p\n", interp);*/ @@ -30984,7 +31003,7 @@ /*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); */ - assert(object->id); + assert(object->id != NULL); /*fprintf(stderr, " ... delete object %s %p, class=%s id %p ns %p\n", ObjectName(object), object, ClassName(object->cl), object->id, object->nsPtr);*/ @@ -31126,7 +31145,7 @@ int i, flags; NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(clientData != NULL); + nonnull_assert(clientData != NULL); /*fprintf(stderr, "ExitHandler\n");*/ @@ -31240,7 +31259,7 @@ Nsf_ThreadExitProc(ClientData clientData) { void Nsf_ExitProc(ClientData clientData); - assert(clientData != NULL); + nonnull_assert(clientData != NULL); /*fprintf(stderr, "+++ Nsf_ThreadExitProc\n");*/ @@ -31257,7 +31276,7 @@ void Nsf_ExitProc(ClientData clientData) { - assert(clientData != NULL); + nonnull_assert(clientData != NULL); /*fprintf(stderr, "+++ Nsf_ExitProc\n");*/ #if defined(TCL_THREADS) @@ -31275,7 +31294,7 @@ static void RegisterExitHandlers(ClientData clientData) { - assert(clientData != NULL); + nonnull_assert(clientData != NULL); Tcl_Preserve(clientData); #if defined(TCL_THREADS) @@ -31307,7 +31326,7 @@ static int stubsInitialized = 0; #endif - assert(interp != NULL); + nonnull_assert(interp != NULL); #if 0 ProfilerStart("profiler"); @@ -31368,22 +31387,21 @@ */ NsfMutexLock(&initMutex); Nsf_OT_byteCodeType = Tcl_GetObjType("bytecode"); - assert(Nsf_OT_byteCodeType); + assert(Nsf_OT_byteCodeType != NULL); Nsf_OT_tclCmdNameType = Tcl_GetObjType("cmdName"); - assert(Nsf_OT_tclCmdNameType); + assert(Nsf_OT_tclCmdNameType != NULL); Nsf_OT_listType = Tcl_GetObjType("list"); - assert(Nsf_OT_listType); + assert(Nsf_OT_listType != NULL); Nsf_OT_intType = Tcl_GetObjType("int"); - assert(Nsf_OT_intType); + assert(Nsf_OT_intType != NULL); Nsf_OT_doubleType = Tcl_GetObjType("double"); - assert(Nsf_OT_doubleType); + assert(Nsf_OT_doubleType != NULL); NsfMutexUnlock(&initMutex); - /* * Initialize the pointer converter, the enumeration types and cmd * definitions tables and load it with the generated information for @@ -31577,7 +31595,7 @@ TclObjLookupVar(interp, varNameObj, NULL, 0, "access", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr); Nsf_OT_parsedVarNameType = varNameObj->typePtr; - assert(Nsf_OT_parsedVarNameType); + assert(Nsf_OT_parsedVarNameType != NULL); DECR_REF_COUNT(varNameObj); } @@ -31602,7 +31620,7 @@ EXTERN int Nsf_SafeInit(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); /*** dummy for now **/ return Nsf_Init(interp); Index: generic/nsf.h =================================================================== diff -u -r695325563d9a19c086388df3d98e7687246c97f4 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsf.h (.../nsf.h) (revision 695325563d9a19c086388df3d98e7687246c97f4) +++ generic/nsf.h (.../nsf.h) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -361,6 +361,13 @@ # define NSF_nonnull(ARGS) #endif +#if __GNUC_PREREQ(6, 0) +# define NSF_nonnull_assert(assertion) +#else +# define NSF_nonnull_assert(assertion) assert((assertion)) +#endif + + /* unforunately, we can't combine NSF_attribute_format() with functions called via stubs */ #if __GNUC_PREREQ(3, 4) # define NSF_attribute_format(ARGS) __attribute__((format ARGS)) Index: generic/nsfAPI.h =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfAPI.h (.../nsfAPI.h) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -868,7 +868,7 @@ NsfCAllocMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -890,7 +890,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -914,7 +914,7 @@ NsfCDeallocMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -936,7 +936,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -961,7 +961,7 @@ NsfCGetCachendParametersMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -983,7 +983,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1009,7 +1009,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1034,7 +1034,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1058,7 +1058,7 @@ NsfCSuperclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1080,7 +1080,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1105,7 +1105,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1131,7 +1131,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1157,7 +1157,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1182,7 +1182,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1227,7 +1227,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1253,7 +1253,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1283,7 +1283,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1329,7 +1329,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1354,7 +1354,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1401,7 +1401,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1429,7 +1429,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -1475,7 +1475,7 @@ ParseContext pc; NsfClass *cl; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); cl = NsfObjectToClass(clientData); @@ -2517,7 +2517,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2542,7 +2542,7 @@ NsfOCgetMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2562,7 +2562,7 @@ NsfOClassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2582,7 +2582,7 @@ NsfOCleanupMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2603,7 +2603,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2626,7 +2626,7 @@ NsfODestroyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2647,7 +2647,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2671,7 +2671,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2695,7 +2695,7 @@ NsfOInstvarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2710,7 +2710,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2734,7 +2734,7 @@ NsfONoinitMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2754,7 +2754,7 @@ NsfORequireNamespaceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2774,7 +2774,7 @@ NsfOResidualargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2788,7 +2788,7 @@ NsfOUplevelMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2802,7 +2802,7 @@ NsfOUpvarMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2816,7 +2816,7 @@ NsfOVolatileMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2837,7 +2837,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2861,7 +2861,7 @@ NsfObjInfoClassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2882,7 +2882,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2906,7 +2906,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2931,7 +2931,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2956,7 +2956,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -2980,7 +2980,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3003,7 +3003,7 @@ NsfObjInfoHasnamespaceMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3024,7 +3024,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3048,7 +3048,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3072,7 +3072,7 @@ NsfObjInfoLookupMethodMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3093,7 +3093,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3123,7 +3123,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3167,7 +3167,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3193,7 +3193,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3218,7 +3218,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3245,7 +3245,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3269,7 +3269,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3312,7 +3312,7 @@ NsfObjInfoNameMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3333,7 +3333,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3357,7 +3357,7 @@ NsfObjInfoParentMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST* objv) { NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3378,7 +3378,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3403,7 +3403,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; @@ -3428,7 +3428,7 @@ ParseContext pc; NsfObject *obj; - assert(clientData != NULL); + NSF_nonnull_assert(clientData != NULL); assert(objc > 0); obj = (NsfObject *)clientData; Index: generic/nsfCmdDefinitions.c =================================================================== diff -u -r24571ae44c492c681d3efd2f2d2f5169ad7d6d57 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfCmdDefinitions.c (.../nsfCmdDefinitions.c) (revision 24571ae44c492c681d3efd2f2d2f5169ad7d6d57) +++ generic/nsfCmdDefinitions.c (.../nsfCmdDefinitions.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -60,7 +60,7 @@ void Nsf_CmdDefinitionInit(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfMutexLock(&cmdDefinitonMutex); @@ -90,8 +90,8 @@ Nsf_CmdDefinitionRegister(Tcl_Interp *interp, Nsf_methodDefinition *definitionRecords) { Nsf_methodDefinition *ePtr; - assert(interp != NULL); - assert(definitionRecords != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(definitionRecords != NULL); for (ePtr = definitionRecords; ePtr->methodName; ePtr++) { Register(interp, ePtr); @@ -118,7 +118,7 @@ Nsf_CmdDefinitionGet(Tcl_ObjCmdProc *proc) { Tcl_HashEntry *hPtr; - assert(proc != NULL); + nonnull_assert(proc != NULL); NsfMutexLock(&cmdDefinitonMutex); hPtr = Tcl_FindHashEntry(cmdDefinitonHashTablePtr, (char *)proc); @@ -152,8 +152,8 @@ Tcl_HashEntry *hPtr; int isNew; - assert(interp != NULL); - assert(methodDefinition != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodDefinition != NULL); NsfMutexLock(&cmdDefinitonMutex); hPtr = Tcl_CreateHashEntry(cmdDefinitonHashTablePtr, (char *)methodDefinition->proc, &isNew); Index: generic/nsfCmdPtr.c =================================================================== diff -u -r2e1a88ed8dfe12a82274e26f1e79156d69b618fc -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfCmdPtr.c (.../nsfCmdPtr.c) (revision 2e1a88ed8dfe12a82274e26f1e79156d69b618fc) +++ generic/nsfCmdPtr.c (.../nsfCmdPtr.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -43,27 +43,29 @@ static NSF_INLINE ClientData NsfGetClientDataFromCmdPtr(Tcl_Command cmd) { - assert(cmd != NULL); + nonnull_assert(cmd != NULL); /*fprintf(stderr, "objProc=%p %p\n", Tcl_Command_objProc(cmd),NsfObjDispatch);*/ if (likely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) { return Tcl_Command_objClientData(cmd); + } else { - cmd = TclGetOriginalCommand(cmd); - if (likely(cmd != NULL) && unlikely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) { - /*fprintf(stderr, "???? got cmd right in 2nd round\n");*/ - return Tcl_Command_objClientData(cmd); + Tcl_Command cmd1 = TclGetOriginalCommand(cmd); + + if (likely(cmd1 != NULL) && unlikely(Tcl_Command_objProc(cmd1) == NsfObjDispatch)) { + return Tcl_Command_objClientData(cmd1); } return NULL; } } static NSF_INLINE NsfClass* NsfGetClassFromCmdPtr(Tcl_Command cmd) { - ClientData cd = NsfGetClientDataFromCmdPtr(cmd); + ClientData cd; - assert(cmd != NULL); + nonnull_assert(cmd != NULL); + cd = NsfGetClientDataFromCmdPtr(cmd); /*fprintf(stderr, "cd=%p\n",cd);*/ if (likely(cd != NULL)) { return NsfObjectToClass(cd); @@ -75,7 +77,7 @@ static NSF_INLINE NsfObject* NsfGetObjectFromCmdPtr(Tcl_Command cmd) { - assert(cmd != NULL); + nonnull_assert(cmd != NULL); return (NsfObject*) NsfGetClientDataFromCmdPtr(cmd); } Index: generic/nsfDebug.c =================================================================== diff -u -r714726da8aa70930a6f1f482e48ab98e4af0b88b -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfDebug.c (.../nsfDebug.c) (revision 714726da8aa70930a6f1f482e48ab98e4af0b88b) +++ generic/nsfDebug.c (.../nsfDebug.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -63,7 +63,7 @@ void NsfReportVars(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); Tcl_SetVar(interp, "::nsf::version", NSF_VERSION, TCL_GLOBAL_ONLY); Tcl_SetVar(interp, "::nsf::patchLevel", NSF_PATCHLEVEL, TCL_GLOBAL_ONLY); @@ -119,7 +119,7 @@ CallFrame *f, *v; Tcl_Obj *varCmdObj; - assert(interp != NULL); + nonnull_assert(interp != NULL); f = iPtr->framePtr; v = iPtr->varFramePtr; @@ -184,8 +184,8 @@ NsfPrintObjv(char *string, int objc, Tcl_Obj *CONST objv[]) { int j; - assert(string != NULL); - assert(objv != NULL); + nonnull_assert(string != NULL); + nonnull_assert(objv != NULL); fprintf(stderr, "%s", string); for (j = 0; j < objc; j++) { @@ -218,7 +218,7 @@ static Tcl_ThreadDataKey memCountFlagKey; Tcl_HashTable *tablePtr; - assert(initialized != NULL); + nonnull_assert(initialized != NULL); tablePtr = (Tcl_HashTable *)Tcl_GetThreadData(&memCountTableKey, sizeof(Tcl_HashTable)); *initialized = (int *)Tcl_GetThreadData(&memCountFlagKey, sizeof(int)); @@ -252,7 +252,7 @@ Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); Tcl_HashEntry *hPtr; - assert(id != NULL); + nonnull_assert(id != NULL); if (!*tableInitialized) { fprintf(stderr, "+++ alloc %s %p\n", id, p); @@ -303,7 +303,7 @@ Tcl_HashTable *tablePtr = NsfMemCountGetTable(&tableInitialized); Tcl_HashEntry *hPtr; - assert(id != NULL); + nonnull_assert(id != NULL); if (!*tableInitialized) { fprintf(stderr, "+++ free %s %p !tableInitialized !\n", id, p); Index: generic/nsfEnumerationType.c =================================================================== diff -u -rdbd95b0155c23213b81125e318b0691cb75f66f5 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfEnumerationType.c (.../nsfEnumerationType.c) (revision dbd95b0155c23213b81125e318b0691cb75f66f5) +++ generic/nsfEnumerationType.c (.../nsfEnumerationType.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -59,7 +59,7 @@ void Nsf_EnumerationTypeInit(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfMutexLock(&enumerationMutex); @@ -89,8 +89,8 @@ Nsf_EnumerationTypeRegister(Tcl_Interp *interp, Nsf_EnumeratorConverterEntry *typeRecords) { Nsf_EnumeratorConverterEntry *ePtr; - assert(interp != NULL); - assert(typeRecords != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(typeRecords != NULL); for (ePtr = typeRecords; ePtr->converter; ePtr++) { int result = Register(interp, ePtr->domain, ePtr->converter); @@ -122,7 +122,7 @@ Tcl_HashSearch hSrch; const char* domain = NULL; - assert(converter != NULL); + nonnull_assert(converter != NULL); NsfMutexLock(&enumerationMutex); @@ -160,8 +160,8 @@ Tcl_HashEntry *hPtr; int isNew; - assert(interp != NULL); - assert(converter != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(converter != NULL); NsfMutexLock(&enumerationMutex); hPtr = Tcl_CreateHashEntry(enumerationHashTablePtr, domain, &isNew); Index: generic/nsfError.c =================================================================== diff -u -r2e1a88ed8dfe12a82274e26f1e79156d69b618fc -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfError.c (.../nsfError.c) (revision 2e1a88ed8dfe12a82274e26f1e79156d69b618fc) +++ generic/nsfError.c (.../nsfError.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -148,8 +148,8 @@ { va_list ap; - assert(dsPtr != NULL); - assert(fmt != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(fmt != NULL); va_start(ap, fmt); NsfDStringVPrintf(dsPtr, fmt, ap); @@ -174,8 +174,8 @@ void NsfDStringArgv(Tcl_DString *dsPtr, int objc, Tcl_Obj *CONST objv[]) { - assert(dsPtr != NULL); - assert(objv != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(objv != NULL); if (objc > 0) { int i; @@ -281,8 +281,8 @@ Tcl_Obj *methodPathObj, char *arglist) { int need_space = 0; - assert(interp != NULL); - assert(msg != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(msg != NULL); Tcl_ResetResult(interp); Tcl_AppendResult(interp, msg, " should be \"", (char *) NULL); @@ -333,9 +333,9 @@ Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj) { Tcl_Obj *argStringObj = NsfParamDefsSyntax(interp, paramPtr, NULL, NULL); - assert(interp != NULL); - assert(errorMsg != NULL); - assert(paramPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(errorMsg != NULL); + nonnull_assert(paramPtr != NULL); NsfObjWrongArgs(interp, errorMsg, cmdNameObj, methodPathObj, ObjStr(argStringObj)); DECR_REF_COUNT2("paramDefsObj", argStringObj); @@ -365,10 +365,10 @@ Tcl_Obj *methodPathObj) { Tcl_DString ds, *dsPtr = &ds; - assert(interp != NULL); - assert(argumentString != NULL); - assert(paramPtr != NULL); - assert(methodPathObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(argumentString != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(methodPathObj != NULL); DSTRING_INIT(dsPtr); Tcl_DStringAppend(dsPtr, "invalid argument '", -1); @@ -405,11 +405,11 @@ Tcl_DString ds, *dsPtr = &ds; Nsf_Param const *pPtr; - assert(interp != NULL); - assert(argumentString != NULL); - assert(currentParamPtr != NULL); - assert(paramPtr != NULL); - assert(methodPathObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(argumentString != NULL); + nonnull_assert(currentParamPtr != NULL); + nonnull_assert(paramPtr != NULL); + nonnull_assert(methodPathObj != NULL); DSTRING_INIT(dsPtr); Tcl_DStringAppend(dsPtr, "invalid non-positional argument '", -1); @@ -450,9 +450,9 @@ NsfDispatchClientDataError(Tcl_Interp *interp, ClientData clientData, const char *what, const char *methodName) { - assert(interp != NULL); - assert(what != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(what != NULL); + nonnull_assert(methodName != NULL); if (clientData != NULL) { return NsfPrintError(interp, "method %s not dispatched on valid %s", @@ -481,7 +481,7 @@ int NsfNoCurrentObjectError(Tcl_Interp *interp, const char *what) { - assert(interp != NULL); + nonnull_assert(interp != NULL); return NsfPrintError(interp, "no current object; %s called outside the context of a Next Scripting method", (what != NULL) ? what : "command"); Index: generic/nsfInt.h =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfInt.h (.../nsfInt.h) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsfInt.h (.../nsfInt.h) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -104,12 +104,20 @@ # define nonnull(ARGS) #endif +#if __GNUC_PREREQ(6, 0) +# define nonnull_assert(assertion) +#else +# define nonnull_assert(assertion) assert((assertion)) +#endif + + #if __GNUC_PREREQ(4, 9) # define returns_nonnull __attribute__((returns_nonnull)) #else # define returns_nonnull #endif + /* * Tries to use gcc __attribute__ unused and mangles the name, so the * attribute could not be used, if declared as unused. Index: generic/nsfObj.c =================================================================== diff -u -r15271802456b460be45984047976d644cf2b92a4 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfObj.c (.../nsfObj.c) (revision 15271802456b460be45984047976d644cf2b92a4) +++ generic/nsfObj.c (.../nsfObj.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -360,7 +360,7 @@ { Mixinreg *mixinRegPtr = (Mixinreg *)objPtr->internalRep.twoPtrValue.ptr1; - assert(mixinRegPtr != NULL); + nonnull_assert(mixinRegPtr != NULL); /*fprintf(stderr, "MixinregFreeInternalRep freeing mixinReg %p class %p guard %p refcount before decr %d\n", mixinRegPtr, mixinRegPtr->mixin, mixinRegPtr->guardObj, (&(mixinRegPtr->mixin)->object)->refCount);*/ @@ -389,7 +389,7 @@ { register Mixinreg *srcPtr = (Mixinreg *)srcObjPtr->internalRep.twoPtrValue.ptr1, *dstPtr; - assert(srcPtr != NULL); + nonnull_assert(srcPtr != NULL); #if defined(METHOD_OBJECT_TRACE) fprintf(stderr, "MixinregDupInternalRep src %p dst %p\n", @@ -514,10 +514,10 @@ int NsfMixinregGet(Tcl_Interp *interp, Tcl_Obj *obj, NsfClass **clPtr, Tcl_Obj **guardObj) { - assert(interp != NULL); - assert(obj != NULL); - assert(clPtr != NULL); - assert(guardObj != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(obj != NULL); + nonnull_assert(clPtr != NULL); + nonnull_assert(guardObj != NULL); if (obj->typePtr == &NsfMixinregObjType) { Mixinreg *mixinRegPtr = obj->internalRep.twoPtrValue.ptr1; @@ -629,7 +629,7 @@ { Filterreg *filterregPtr = (Filterreg *)objPtr->internalRep.twoPtrValue.ptr1; - assert(filterregPtr != NULL); + nonnull_assert(filterregPtr != NULL); /*fprintf(stderr, "FilterregFreeInternalRep freeing filterreg %p class %p guard %p\n", filterregPtr, filterregPtr->class, filterregPtr->guardObj);*/ @@ -763,9 +763,9 @@ int NsfFilterregGet(Tcl_Interp *UNUSED(interp), Tcl_Obj *obj, Tcl_Obj **filterObj, Tcl_Obj **guardObj) { - assert(obj != NULL); - assert(filterObj != NULL); - assert(guardObj != NULL); + nonnull_assert(obj != NULL); + nonnull_assert(filterObj != NULL); + nonnull_assert(guardObj != NULL); if (obj->typePtr == &NsfFilterregObjType) { Filterreg *filterregPtr = obj->internalRep.twoPtrValue.ptr1; Index: generic/nsfPointer.c =================================================================== diff -u -rdbd95b0155c23213b81125e318b0691cb75f66f5 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfPointer.c (.../nsfPointer.c) (revision dbd95b0155c23213b81125e318b0691cb75f66f5) +++ generic/nsfPointer.c (.../nsfPointer.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -62,10 +62,10 @@ Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr) { int *counterPtr; - assert(interp != NULL); - assert(buffer != NULL); - assert(typeName != NULL); - assert(valuePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(buffer != NULL); + nonnull_assert(typeName != NULL); + nonnull_assert(valuePtr != NULL); counterPtr = Nsf_PointerTypeLookup(interp, typeName); if (counterPtr != NULL) { @@ -115,8 +115,8 @@ Nsf_PointerGet(char *key, const char *prefix) { void *valuePtr = NULL; - assert(key != NULL); - assert(prefix != NULL); + nonnull_assert(key != NULL); + nonnull_assert(prefix != NULL); /* make sure to return the right type of hash entry */ if (strncmp(prefix, key, strlen(prefix)) == 0) { @@ -160,7 +160,7 @@ Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; - assert(valuePtr != NULL); + nonnull_assert(valuePtr != NULL); for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { @@ -195,7 +195,7 @@ Tcl_HashEntry *hPtr; int result; - assert(valuePtr != NULL); + nonnull_assert(valuePtr != NULL); NsfMutexLock(&pointerMutex); hPtr = (key != NULL) ? Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL) @@ -242,11 +242,11 @@ ClientData *clientData, Tcl_Obj **outObjPtr) { void *valuePtr; - assert(interp != NULL); - assert(objPtr != NULL); - assert(pPtr != NULL); - assert(clientData != NULL); - assert(outObjPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objPtr != NULL); + nonnull_assert(pPtr != NULL); + nonnull_assert(clientData != NULL); + nonnull_assert(outObjPtr != NULL); *outObjPtr = objPtr; valuePtr = Nsf_PointerGet(ObjStr(objPtr), pPtr->type); @@ -277,9 +277,9 @@ Tcl_HashEntry *hPtr; int isNew; - assert(interp != NULL); - assert(typeName != NULL); - assert(counterPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(typeName != NULL); + nonnull_assert(counterPtr != NULL); NsfMutexLock(&pointerMutex); @@ -315,8 +315,8 @@ Nsf_PointerTypeLookup(Tcl_Interp *interp, const char* typeName) { Tcl_HashEntry *hPtr; - assert(interp != NULL); - assert(typeName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(typeName != NULL); NsfMutexLock(&pointerMutex); hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, typeName, NULL); @@ -346,7 +346,7 @@ void Nsf_PointerInit(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfMutexLock(&pointerMutex); @@ -379,7 +379,7 @@ void Nsf_PointerExit(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfMutexLock(&pointerMutex); if (--pointerTableRefCount == 0) { Index: generic/nsfProfile.c =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfProfile.c (.../nsfProfile.c) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -68,8 +68,8 @@ Tcl_HashEntry *hPtr; int isNew; - assert(table != NULL); - assert(keyStr != NULL); + nonnull_assert(table != NULL); + nonnull_assert(keyStr != NULL); hPtr = Tcl_CreateHashEntry(table, keyStr, &isNew); if (isNew != 0) { @@ -166,7 +166,7 @@ if (Tcl_ListObjGetElements(interp, objPtr, &oc, &ov) != TCL_OK) { if (verbose) { - NsfLog(interp, NSF_LOG_WARN, "invalid list element '%s'", ObjStr(objPtr)); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: invalid list element '%s'", ObjStr(objPtr)); result = TCL_ERROR; } } else { @@ -177,13 +177,13 @@ *nameObjPtr = ov[0]; } else { if (verbose) { - NsfLog(interp, NSF_LOG_WARN, "second element of '%s' must be an integer", ObjStr(objPtr)); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: second element of '%s' must be an integer", ObjStr(objPtr)); result = TCL_ERROR; } } } else { if (verbose) { - NsfLog(interp, NSF_LOG_WARN, "list element '%s' not a valid pair", ObjStr(objPtr)); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: list element '%s' not a valid pair", ObjStr(objPtr)); result = TCL_ERROR; } } @@ -215,7 +215,7 @@ int oldProfileState, oc; Tcl_Obj **ov; - assert(interp != NULL); + nonnull_assert(interp != NULL); rst = RUNTIME_STATE(interp); profilePtr = &rst->profile; @@ -228,7 +228,7 @@ */ if (withEnable == 1) { if (rst->doProfile == 1) { - NsfLog(interp, NSF_LOG_WARN, "tracing is already active"); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: tracing is already active"); } else { /* * Activate profile trace. @@ -238,7 +238,7 @@ * A list of cammands was provided */ if (Tcl_ListObjGetElements(interp, builtinObjs, &oc, &ov) != TCL_OK) { - NsfLog(interp, NSF_LOG_WARN, "argument '%s' is not a list of commands", ObjStr(builtinObjs)); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: argument '%s' is not a list of commands", ObjStr(builtinObjs)); } else { NsfShadowTclCommandInfo *ti = NEW_ARRAY(NsfShadowTclCommandInfo, oc); int i; @@ -250,7 +250,7 @@ if (GetPair(interp, ov[i], 1, &nameObj, &nrArgs) == TCL_OK) { ti[i].nrArgs = nrArgs; if (NsfReplaceCommand(interp, nameObj, Nsf_ProfileFilterObjCmd, &ti[i], &ti[i]) != TCL_OK) { - NsfLog(interp, NSF_LOG_WARN, "List element '%s' is not a command", ObjStr(nameObj)); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: list element '%s' is not a command", ObjStr(nameObj)); } } } @@ -267,7 +267,7 @@ if (profilePtr->shadowedObjs != NULL) { if (Tcl_ListObjGetElements(interp, profilePtr->shadowedObjs, &oc, &ov) != TCL_OK) { - NsfLog(interp, NSF_LOG_WARN, "shadowed objects are apparently not a list"); + NsfLog(interp, NSF_LOG_WARN, "nsfprofile: shadowed objects are apparently not a list"); } else { int i; @@ -285,7 +285,7 @@ FREE(NsfShadowTclCommandInfo*, profilePtr->shadowedTi); profilePtr->shadowedTi = NULL; profilePtr->shadowedObjs = NULL; - fprintf(stderr, "freed profile information\n"); + /*fprintf(stderr, "freed profile information\n");*/ } } @@ -412,9 +412,9 @@ void NsfProfileObjectLabel(Tcl_DString *dsPtr, NsfObject *obj, NsfClass *cl, const char *methodName) { - assert(dsPtr != NULL); - assert(obj != NULL); - assert(methodName != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(obj != NULL); + nonnull_assert(methodName != NULL); Tcl_DStringAppend(dsPtr, ObjectName(obj), -1); Tcl_DStringAppend(dsPtr, " ", 1); @@ -424,9 +424,9 @@ static void NsfProfileMethodLabel(Tcl_DString *dsPtr, NsfObject *obj, NsfClass *cl, const char *methodName) { - assert(dsPtr != NULL); - assert(obj != NULL); - assert(methodName != NULL); + nonnull_assert(dsPtr != NULL); + nonnull_assert(obj != NULL); + nonnull_assert(methodName != NULL); if (cl != NULL) { Tcl_DStringAppend(dsPtr, ObjStr(cl->object.cmdName), -1); @@ -535,8 +535,8 @@ NsfProfile *profilePtr = &rst->profile; struct timeval trt; - assert(interp != NULL); - assert(cscPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); gettimeofday(&trt, NULL); @@ -620,8 +620,8 @@ double totalMicroSec; struct timeval trt; - assert(interp != NULL); - assert(methodName != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(methodName != NULL); gettimeofday(&trt, NULL); @@ -658,7 +658,7 @@ Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; - assert(table != NULL); + nonnull_assert(table != NULL); for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { @@ -689,7 +689,7 @@ NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; struct timeval trt; - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfProfileClearTable(&profilePtr->objectData); NsfProfileClearTable(&profilePtr->methodData); @@ -727,8 +727,8 @@ Tcl_HashSearch hSrch; Tcl_HashEntry *hPtr; - assert(interp != NULL); - assert(table != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(table != NULL); for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { @@ -769,7 +769,7 @@ long totalMicroSec; struct timeval trt; - assert(interp != NULL); + nonnull_assert(interp != NULL); gettimeofday(&trt, NULL); totalMicroSec = (trt.tv_sec - profilePtr->startSec) * 1000000 + (trt.tv_usec - profilePtr->startUSec); @@ -805,7 +805,7 @@ NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; struct timeval trt; - assert(interp != NULL); + nonnull_assert(interp != NULL); Tcl_InitHashTable(&profilePtr->objectData, TCL_STRING_KEYS); Tcl_InitHashTable(&profilePtr->methodData, TCL_STRING_KEYS); @@ -838,7 +838,7 @@ NsfProfileFree(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; - assert(interp != NULL); + nonnull_assert(interp != NULL); NsfProfileClearData(interp); Tcl_DeleteHashTable(&profilePtr->objectData); Index: generic/nsfShadow.c =================================================================== diff -u -r19c84744084963110f84f4ce28fbf55714c79635 -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfShadow.c (.../nsfShadow.c) (revision 19c84744084963110f84f4ce28fbf55714c79635) +++ generic/nsfShadow.c (.../nsfShadow.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -60,9 +60,9 @@ Tcl_Command cmd; int result = TCL_OK; - assert(interp != NULL); - assert(nameObj != NULL); - assert(ti != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(ti != NULL); /*fprintf(stderr," cleanup for %s ti=%p in %p\n", NsfGlobalStrings[name], ti, interp);*/ cmd = Tcl_GetCommandFromObj(interp, nameObj); @@ -104,10 +104,10 @@ NsfShadowTclCommandInfo *ti) { Tcl_Command cmd; - assert(interp != NULL); - assert(nameObj != NULL); - assert(proc != NULL); - assert(ti != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(proc != NULL); + nonnull_assert(ti != NULL); cmd = Tcl_GetCommandFromObj(interp, nameObj); @@ -146,9 +146,9 @@ Tcl_Command cmd; int result = TCL_OK; - assert(interp != NULL); - assert(nameObj != NULL); - assert(ti != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(nameObj != NULL); + nonnull_assert(ti != NULL); /* fprintf(stderr,"NsfReplaceCommand %s\n", ObjStr(nameObj)); */ cmd = Tcl_GetCommandFromObj(interp, nameObj); @@ -199,8 +199,8 @@ Nsf_InfoBodyObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Command cmd; - assert(interp != NULL); - assert(objv != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(objv != NULL); if (objc != 2) { /* wrong # args, let Tcl generate the error */ @@ -406,7 +406,7 @@ int rc = TCL_OK; NsfRuntimeState *rst = RUNTIME_STATE(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); if (load == SHADOW_LOAD) { Index: generic/nsfStack.c =================================================================== diff -u -r2e1a88ed8dfe12a82274e26f1e79156d69b618fc -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfStack.c (.../nsfStack.c) (revision 2e1a88ed8dfe12a82274e26f1e79156d69b618fc) +++ generic/nsfStack.c (.../nsfStack.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -57,8 +57,8 @@ static void CscListAdd(Tcl_Interp *interp, NsfCallStackContent *cscPtr) { - assert(interp != NULL); - assert(cscPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); NsfClassListAdd(&RUNTIME_STATE(interp)->cscList, (NsfClass *)cscPtr, NULL); } @@ -83,9 +83,9 @@ CscListRemove(Tcl_Interp *interp, NsfCallStackContent *cscPtr, NsfClasses **cscListPtr) { NsfClasses *entryPtr, **cscList = &RUNTIME_STATE(interp)->cscList; - assert(interp != NULL); - assert(cscPtr != NULL); - assert(cscListPtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(cscListPtr != NULL); entryPtr = NsfClassListUnlink(cscList, cscPtr); if (entryPtr != NULL) { @@ -186,9 +186,9 @@ static void Nsf_PushFrameObj(Tcl_Interp *interp, NsfObject *object, CallFrame *framePtr) { - assert(interp != NULL); - assert(object != NULL); - assert(framePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); + nonnull_assert(framePtr != NULL); /*fprintf(stderr,"PUSH OBJECT_FRAME (Nsf_PushFrameObj) frame %p\n", framePtr);*/ if (object->nsPtr != NULL) { @@ -211,8 +211,8 @@ static void Nsf_PopFrameObj(Tcl_Interp *interp, CallFrame *framePtr) { - assert(interp != NULL); - assert(framePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(framePtr != NULL); /*fprintf(stderr,"POP OBJECT_FRAME (Nsf_PopFrameObj) frame %p, varTable %p set to NULL, already %d\n", framePtr, Tcl_CallFrame_varTablePtr(framePtr), Tcl_CallFrame_varTablePtr(framePtr) == NULL);*/ @@ -244,9 +244,9 @@ Nsf_PushFrameCsc(Tcl_Interp *interp, NsfCallStackContent *cscPtr, CallFrame *framePtr) { CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); - assert(interp != NULL); - assert(cscPtr != NULL); - assert(framePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(framePtr != NULL); /*fprintf(stderr,"PUSH CMETHOD_FRAME (Nsf_PushFrameCsc) frame %p cscPtr %p methodName %s\n", framePtr, cscPtr, Tcl_GetCommandName(interp, cscPtr->cmdPtr));*/ @@ -259,7 +259,7 @@ NSF_INLINE static void Nsf_PopFrameCsc(Tcl_Interp *interp, CallFrame *UNUSED(framePtr)) { - assert(interp != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr,"POP CMETHOD_FRAME (Nsf_PopFrameCsc) frame %p, varTablePtr = %p\n", framePtr, Tcl_CallFrame_varTablePtr(framePtr));*/ @@ -289,7 +289,7 @@ static Tcl_CallFrame * CallStackGetActiveProcFrame(Tcl_CallFrame *framePtr) { - assert(framePtr != NULL); + nonnull_assert(framePtr != NULL); do { register int flag = Tcl_CallFrame_isProcCallFrame(framePtr); @@ -332,7 +332,7 @@ static Tcl_CallFrame * CallStackNextFrameOfType(Tcl_CallFrame *framePtr, unsigned int flags) { - assert(framePtr != NULL); + nonnull_assert(framePtr != NULL); do { if (Tcl_CallFrame_isProcCallFrame(framePtr) & flags) { @@ -374,7 +374,7 @@ GetSelfObj(Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); /*fprintf(stderr, "GetSelfObj interp has frame %p and var-frame %p\n", Tcl_Interp_framePtr(interp), Tcl_Interp_varFramePtr(interp));*/ @@ -430,7 +430,7 @@ static Tcl_CallFrame* CallStackGetTclFrame(Tcl_Interp *interp, Tcl_CallFrame *varFramePtr, int skip) { - assert(interp != NULL); + nonnull_assert(interp != NULL); assert(skip >= 0); /* NsfShowStack(interp); */ @@ -474,7 +474,7 @@ CallStackGetTopFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); varFramePtr; @@ -499,7 +499,7 @@ CallStackGetTopFrame0(Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); varFramePtr; @@ -543,7 +543,7 @@ register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); int lvl = Tcl_CallFrame_level(varFramePtr); - assert(interp != NULL); + nonnull_assert(interp != NULL); for (; likely(varFramePtr != NULL); varFramePtr = Tcl_CallFrame_callerVarPtr(varFramePtr)) { @@ -608,7 +608,7 @@ NsfCallStackFindActiveFrame(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); /* skip #offset frames */ for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); @@ -658,8 +658,8 @@ CallStackUseActiveFrame(Tcl_Interp *interp, callFrameContext *ctx) { Tcl_CallFrame *framePtr, *inFramePtr; - assert(interp != NULL); - assert(ctx != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(ctx != NULL); inFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); @@ -700,8 +700,8 @@ static void CallStackRestoreSavedFrames(Tcl_Interp *interp, callFrameContext *ctx) { - assert(interp != NULL); - assert(ctx != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(ctx != NULL); if (ctx->frameSaved != 0) { /*fprintf(stderr, "CallStackRestoreSavedFrames drops %p restores %p\n", @@ -730,7 +730,7 @@ CallStackFindActiveFilter(Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - assert(interp != NULL); + nonnull_assert(interp != NULL); for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { @@ -767,8 +767,8 @@ register Tcl_CallFrame *varFramePtr; NsfCallStackContent *cscPtr = NULL; - assert(framePtr != NULL); - assert(framePtrPtr != NULL); + nonnull_assert(framePtr != NULL); + nonnull_assert(framePtrPtr != NULL); for (/* Skipping the starting frame, assuming a "leaf" frame in an ensemble dispatch */ varFramePtr = Tcl_CallFrame_callerPtr(framePtr); @@ -824,8 +824,8 @@ Tcl_Obj *resultObj; Tcl_Obj *methodPathObj = Tcl_NewListObj(0, NULL); - assert(interp != NULL); - assert(framePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(framePtr != NULL); /* * Append all ensemble names to the specified list obj @@ -926,8 +926,8 @@ FilterActiveOnObj(Tcl_Interp *interp, NsfObject *object, Tcl_Command cmd) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - assert(interp != NULL); - assert(object != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(object != NULL); for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { @@ -963,9 +963,9 @@ CallStackReplaceVarTableReferences(Tcl_Interp *interp, TclVarHashTable *oldVarTablePtr, TclVarHashTable *newVarTablePtr) { Tcl_CallFrame *framePtr; - assert(interp != NULL); - assert(oldVarTablePtr != NULL); - assert(newVarTablePtr != NULL); + nonnull_assert(interp != NULL); + nonnull_assert(oldVarTablePtr != NULL); + nonnull_assert(newVarTablePtr != NULL); for (framePtr = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { @@ -1003,7 +1003,7 @@ static void CallStackPopAll(Tcl_Interp *interp) { - assert(interp != NULL); + nonnull_assert(interp != NULL); if (RUNTIME_STATE(interp)->debugLevel > 2) { NsfShowStack(interp); @@ -1094,7 +1094,7 @@ cscPtr->flags = 0; } #else - assert(cscPtr != NULL); + nonnull_assert(cscPtr != NULL); (void)interp; (void)cmd; cscPtr->flags = 0; @@ -1129,8 +1129,8 @@ struct timeval trt; #endif - assert(cscPtr != NULL); - assert(object != NULL); + nonnull_assert(cscPtr != NULL); + nonnull_assert(object != NULL); #if defined(NSF_PROFILE) gettimeofday(&trt, NULL); @@ -1205,9 +1205,9 @@ CscFinish_(Tcl_Interp *interp, NsfCallStackContent *cscPtr) { NsfObject *object; - assert(interp != NULL); - assert(cscPtr != NULL); - assert(cscPtr->self); + nonnull_assert(interp != NULL); + nonnull_assert(cscPtr != NULL); + assert(cscPtr->self != NULL); #if defined(NSF_PROFILE) if (RUNTIME_STATE(interp)->doProfile) { @@ -1308,7 +1308,7 @@ Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp), *prevFramePtr = varFramePtr; - assert(interp != NULL); + nonnull_assert(interp != NULL); if (object != NULL) { fprintf(stderr, "BeginOfCallChain obj %s\n", ObjectName(object)); Index: generic/nsfUtil.c =================================================================== diff -u -r2e1a88ed8dfe12a82274e26f1e79156d69b618fc -r16a02881bff0a0d626d0045dfd96660338d0c314 --- generic/nsfUtil.c (.../nsfUtil.c) (revision 2e1a88ed8dfe12a82274e26f1e79156d69b618fc) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) @@ -100,8 +100,8 @@ char tmp[LONG_AS_STRING], *pointer = &tmp[1], *string, *p; *tmp = 0; - assert(buf != NULL); - assert(lengthPtr != NULL); + nonnull_assert(buf != NULL); + nonnull_assert(lengthPtr != NULL); if (i < 0) { i = -i; @@ -155,7 +155,7 @@ NsfStringIncr(NsfStringIncrStruct *iss) { char newch, *currentChar; - assert(iss != NULL); + nonnull_assert(iss != NULL); currentChar = iss->buffer + iss->bufSize - 2; newch = *(alphabet + chartable[(unsigned)*currentChar]); @@ -220,7 +220,7 @@ int i = 0; const size_t bufSize = (blockIncrement > 2) ? blockIncrement : 2; - assert(iss != NULL); + nonnull_assert(iss != NULL); for (p=alphabet; *p; p++) { chartable[(int)*p] = ++i; @@ -242,7 +242,7 @@ void NsfStringIncrFree(NsfStringIncrStruct *iss) { - assert(iss != NULL); + nonnull_assert(iss != NULL); ckfree(iss->buffer); }