Index: generic/nsf.c =================================================================== diff -u -r8f7c25f980c5433948a27be3cab5bb15d754b921 -r7ad03f0f42ae651084aefb409c6c00b2318821c7 --- generic/nsf.c (.../nsf.c) (revision 8f7c25f980c5433948a27be3cab5bb15d754b921) +++ generic/nsf.c (.../nsf.c) (revision 7ad03f0f42ae651084aefb409c6c00b2318821c7) @@ -389,15 +389,15 @@ */ static bool IsRootClass( const NsfClass *class -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool IsRootMetaClass( const NsfClass *class -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool IsBaseClass( const NsfObject *object -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool IsMetaClass( Tcl_Interp *interp, NsfClass *class, bool withMixins @@ -475,7 +475,7 @@ NSF_INLINE static NsfProcContext *ProcContextGet( const Tcl_Command cmdPtr -) nonnull(1) pure; +) nonnull(1) NSF_pure; static NsfProcContext *ProcContextRequire( Tcl_Command cmd @@ -1402,13 +1402,13 @@ * EXTERN callable routines for the preliminary C interface ***********************************************************************/ Nsf_Object * NsfGetSelfObj(const Tcl_Interp *interp) - nonnull(1) pure; + nonnull(1) NSF_pure; Nsf_Object * NsfGetObject(Tcl_Interp *interp, const char *name) nonnull(1) nonnull(2); Nsf_Class * NsfGetClass(Tcl_Interp *interp, const char *name) nonnull(1) nonnull(2); Nsf_Class * NsfIsClass(Tcl_Interp *interp, ClientData clientData) - nonnull(1) nonnull(2) pure; + nonnull(1) nonnull(2) NSF_pure; void NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *object) nonnull(1) nonnull(2); Tcl_Obj * Nsf_ObjSetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, @@ -1431,11 +1431,11 @@ void NsfSetObjClientData(Tcl_Interp *UNUSED(interp), Nsf_Object *object, ClientData data) nonnull(1) nonnull(2); ClientData NsfGetObjClientData(Tcl_Interp *UNUSED(interp), Nsf_Object *object) - nonnull(1) nonnull(2) pure; + nonnull(1) nonnull(2) NSF_pure; void NsfSetClassClientData(Tcl_Interp *UNUSED(interp), Nsf_Class *class, ClientData data) nonnull(1) nonnull(2); ClientData NsfGetClassClientData(Tcl_Interp *UNUSED(interp), Nsf_Class *class) - nonnull(1) nonnull(2) pure; + nonnull(1) nonnull(2) NSF_pure; Nsf_Object * NsfGetSelfObj(const Tcl_Interp *interp) { @@ -1716,7 +1716,7 @@ *---------------------------------------------------------------------- */ static const char * NSTail(const char *string) - nonnull(1) pure; + nonnull(1) NSF_pure; static const char * NSTail(const char *string) { @@ -2553,7 +2553,7 @@ *---------------------------------------------------------------------- */ static NsfClasses *NsfClassListFind(NsfClasses *clPtr, const NsfClass *class) - nonnull(2) pure; + nonnull(2) NSF_pure; static NsfClasses * NsfClassListFind(NsfClasses *clPtr, const NsfClass *class) { @@ -2806,7 +2806,7 @@ *---------------------------------------------------------------------- */ static bool MustBeBefore(const NsfClass *aClass, const NsfClass *bClass, const NsfClasses *superClasses) - nonnull(1) nonnull(2) nonnull(3) pure; + nonnull(1) nonnull(2) nonnull(3) NSF_pure; static bool MustBeBefore(const NsfClass *aClass, const NsfClass *bClass, const NsfClasses *superClasses) { @@ -3967,7 +3967,7 @@ *---------------------------------------------------------------------- */ NSF_INLINE static bool CmdIsProc(const Tcl_Command cmd) - nonnull(1) pure; + nonnull(1) NSF_pure; NSF_INLINE static bool CmdIsProc(const Tcl_Command cmd) { @@ -3994,7 +3994,7 @@ *---------------------------------------------------------------------- */ NSF_INLINE static bool CmdIsNsfObject(Tcl_Command cmd) - nonnull(1) pure; + nonnull(1) NSF_pure; NSF_INLINE static bool CmdIsNsfObject(Tcl_Command cmd) { @@ -4018,7 +4018,7 @@ *---------------------------------------------------------------------- */ static Proc *GetTclProcFromCommand(const Tcl_Command cmd) - nonnull(1) pure; + nonnull(1) NSF_pure; static Proc * GetTclProcFromCommand(const Tcl_Command cmd) { @@ -4380,7 +4380,7 @@ *---------------------------------------------------------------------- */ static NsfObjectSystem * GetObjectSystem(const NsfObject *object) - nonnull(1) pure; + nonnull(1) NSF_pure; static NsfObjectSystem * GetObjectSystem(const NsfObject *object) { @@ -6083,7 +6083,7 @@ #endif } -static NsfObject *NSNamespaceClientDataObject(ClientData clientData) nonnull(1) pure; +static NsfObject *NSNamespaceClientDataObject(ClientData clientData) nonnull(1) NSF_pure; static NsfObject * NSNamespaceClientDataObject(ClientData clientData) { @@ -6466,19 +6466,23 @@ /*Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); fprintf(stderr, "NSDeleteChild %p table %p numEntries before %d\n", cmd, hPtr->tablePtr, cmdTablePtr->numEntries );*/ - expected = cmdTablePtr->numEntries - - (int)NSDeleteChild(interp, (Tcl_Command)Tcl_GetHashValue(hPtr), NSF_TRUE); + if (NSDeleteChild(interp, (Tcl_Command)Tcl_GetHashValue(hPtr), NSF_TRUE)) { + expected = (NSDeleteChild(interp, (Tcl_Command)Tcl_GetHashValue(hPtr), NSF_TRUE) + ? cmdTablePtr->numEntries - 1 + : cmdTablePtr->numEntries); + } } /* * Finally, delete the classes. */ for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &hSrch); hPtr != NULL; hPtr = Nsf_NextHashEntry(cmdTablePtr, expected, &hSrch)) { - expected = cmdTablePtr->numEntries - - (int)NSDeleteChild(interp, (Tcl_Command)Tcl_GetHashValue(hPtr), NSF_FALSE); + expected = (NSDeleteChild(interp, (Tcl_Command)Tcl_GetHashValue(hPtr), NSF_FALSE) + ? cmdTablePtr->numEntries - 1 + : cmdTablePtr->numEntries); } -} + } /* @@ -6725,7 +6729,7 @@ *---------------------------------------------------------------------- */ NSF_INLINE static bool NSValidObjectName(const char *name, size_t l) - nonnull(1) pure; + nonnull(1) NSF_pure; NSF_INLINE static bool NSValidObjectName(const char *name, size_t l) { @@ -8024,7 +8028,7 @@ * for a command ptr */ static NsfCmdList * CmdListFindCmdInList(const Tcl_Command cmd, NsfCmdList *l) - nonnull(2) nonnull(1) pure; + nonnull(2) nonnull(1) NSF_pure; static NsfCmdList * CmdListFindCmdInList(const Tcl_Command cmd, NsfCmdList *l) { @@ -10225,7 +10229,7 @@ *---------------------------------------------------------------------- */ static NsfCmdList *SeekCurrent(const Tcl_Command cmd, register NsfCmdList *cmdListPtr) - nonnull(2) pure; + nonnull(2) NSF_pure; static NsfCmdList * SeekCurrent(const Tcl_Command cmd, register NsfCmdList *cmdListPtr) { @@ -11022,7 +11026,7 @@ *---------------------------------------------------------------------- */ static int FiltersDefined(Tcl_Interp *interp) - nonnull(1) pure; + nonnull(1) NSF_pure; static int FiltersDefined(Tcl_Interp *interp) { @@ -12607,7 +12611,7 @@ */ NSF_INLINE static Tcl_Obj *ParamDefsGetReturns( const Tcl_Command cmdPtr -) nonnull(1) pure; +) nonnull(1) NSF_pure; NSF_INLINE static Tcl_Obj * ParamDefsGetReturns(const Tcl_Command cmdPtr) { @@ -15077,7 +15081,7 @@ */ static const char *CmdObjProcName( Tcl_Command cmd -) nonnull(1) pure; +) nonnull(1) NSF_pure; static const char * CmdObjProcName( @@ -16339,7 +16343,7 @@ *---------------------------------------------------------------------- */ NSF_INLINE static bool NoMetaChars(const char *pattern) - nonnull(1) pure; + nonnull(1) NSF_pure; NSF_INLINE static bool NoMetaChars(const char *pattern) { @@ -16411,7 +16415,7 @@ static int ConvertToNothing(Tcl_Interp *UNUSED(interp), Tcl_Obj *objPtr, const Nsf_Param *UNUSED(pPtr), ClientData *UNUSED(clientData), Tcl_Obj **outObjPtr) - nonnull(2) nonnull(5) pure; + nonnull(2) nonnull(5) NSF_pure; static int ConvertToNothing(Tcl_Interp *UNUSED(interp), Tcl_Obj *objPtr, const Nsf_Param *UNUSED(pPtr), @@ -19735,7 +19739,7 @@ */ static const char * StripBodyPrefix(const char *body) - nonnull(1) pure; + nonnull(1) NSF_pure; static const char * StripBodyPrefix(const char *body) { @@ -23857,7 +23861,7 @@ *---------------------------------------------------------------------- */ static bool IsRootNamespace(const Tcl_Interp *interp, const Tcl_Namespace *nsPtr) - nonnull(1) nonnull(2) pure; + nonnull(1) nonnull(2) NSF_pure; static bool IsRootNamespace(const Tcl_Interp *interp, const Tcl_Namespace *nsPtr) { @@ -24399,7 +24403,7 @@ */ static const Nsf_Param * NextParam(Nsf_Param const *paramPtr, const Nsf_Param *lastParamPtr) - nonnull(1) nonnull(2) returns_nonnull pure; + nonnull(1) nonnull(2) returns_nonnull NSF_pure; static const Nsf_Param * NextParam(Nsf_Param const *paramPtr, const Nsf_Param *lastParamPtr) { @@ -26197,7 +26201,7 @@ * *---------------------------------------------------------------------- */ -static bool MethodSourceMatches(DefinitionsourceIdx_t withSource, NsfClass *class, NsfObject *object) pure; +static bool MethodSourceMatches(DefinitionsourceIdx_t withSource, NsfClass *class, NsfObject *object) NSF_pure; static bool MethodSourceMatches(DefinitionsourceIdx_t withSource, NsfClass *class, NsfObject *object) { bool result; @@ -26339,7 +26343,7 @@ *---------------------------------------------------------------------- */ static bool ProtectionMatches(CallprotectionIdx_t withCallprotection, Tcl_Command cmd) - nonnull(2) pure; + nonnull(2) NSF_pure; static bool ProtectionMatches(CallprotectionIdx_t withCallprotection, Tcl_Command cmd) { @@ -34850,7 +34854,7 @@ */ static bool ClassHasSubclasses( const NsfClass *class -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool ClassHasSubclasses( @@ -34878,7 +34882,7 @@ */ static bool ClassHasInstances( NsfClass *class -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool ClassHasInstances( @@ -34908,7 +34912,7 @@ */ static bool ObjectHasChildren( const NsfObject *object -) nonnull(1) pure; +) nonnull(1) NSF_pure; static bool ObjectHasChildren( Index: generic/nsf.h =================================================================== diff -u -r1fb16685007123a71b3ee8fb69b8ab67214aed82 -r7ad03f0f42ae651084aefb409c6c00b2318821c7 --- generic/nsf.h (.../nsf.h) (revision 1fb16685007123a71b3ee8fb69b8ab67214aed82) +++ generic/nsf.h (.../nsf.h) (revision 7ad03f0f42ae651084aefb409c6c00b2318821c7) @@ -386,7 +386,13 @@ # define NSF_nonnull_assert(assertion) assert((assertion)) #endif +#if __GNUC_PREREQ(2, 96) +# define NSF_pure __attribute__((pure)) +#else +# define NSF_pure +#endif + /* * Unfortunately, we can't combine NSF_attribute_format() with * functions called via stubs. Index: generic/nsfInt.h =================================================================== diff -u -rf35ab630098876f0efbd8117aa981eb199a45227 -r7ad03f0f42ae651084aefb409c6c00b2318821c7 --- generic/nsfInt.h (.../nsfInt.h) (revision f35ab630098876f0efbd8117aa981eb199a45227) +++ generic/nsfInt.h (.../nsfInt.h) (revision 7ad03f0f42ae651084aefb409c6c00b2318821c7) @@ -155,12 +155,6 @@ # define likely(x) (x) #endif -#if __GNUC_PREREQ(2, 96) -# define pure __attribute__((pure)) -#else -# define pure -#endif - #if __GNUC_PREREQ(3, 3) # define nonnull(ARGS) __attribute__((__nonnull__(ARGS))) #else @@ -856,7 +850,7 @@ nonnull(1); Tcl_Obj *NsfMethodObj(const NsfObject *object, int methodIdx) - nonnull(1) pure; + nonnull(1) NSF_pure; int NsfReplaceCommandCleanup(Tcl_Interp *interp, Tcl_Obj *nameObj, NsfShadowTclCommandInfo *ti) nonnull(1) nonnull(2) nonnull(3); @@ -1357,7 +1351,7 @@ #ifndef HAVE_STRNSTR -char *strnstr(const char *buffer, const char *needle, size_t buffer_len) pure; +char *strnstr(const char *buffer, const char *needle, size_t buffer_len) NSF_pure; #endif /* Index: generic/nsfStack.c =================================================================== diff -u -r62dc29237e6a643169841f002784c7dc0b29f201 -r7ad03f0f42ae651084aefb409c6c00b2318821c7 --- generic/nsfStack.c (.../nsfStack.c) (revision 62dc29237e6a643169841f002784c7dc0b29f201) +++ generic/nsfStack.c (.../nsfStack.c) (revision 7ad03f0f42ae651084aefb409c6c00b2318821c7) @@ -56,26 +56,26 @@ nonnull(1); static Tcl_CallFrame* CallStackGetActiveProcFrame(Tcl_CallFrame *framePtr) - nonnull(1) pure; + nonnull(1) NSF_pure; NSF_INLINE static NsfObject* GetSelfObj2( const Tcl_Interp *UNUSED(interp), Tcl_CallFrame *framePtr -) nonnull(2) pure; +) nonnull(2) NSF_pure; static Tcl_CallFrame* CallStackGetTclFrame( const Tcl_Interp *interp, Tcl_CallFrame *varFramePtr, int skip -) nonnull(1) pure; +) nonnull(1) NSF_pure; static NsfCallStackContent* CallStackGetTopFrame( const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr ) nonnull(1); NSF_INLINE static NsfCallStackContent* CallStackGetTopFrame0(const Tcl_Interp *interp) - nonnull(1) pure; + nonnull(1) NSF_pure; static NsfCallStackContent* NsfCallStackFindCallingContext( const Tcl_Interp *interp, @@ -102,7 +102,7 @@ ) nonnull(1) nonnull(2); static NsfCallStackContent* CallStackFindActiveFilter(const Tcl_Interp *interp) - nonnull(1) pure; + nonnull(1) NSF_pure; static NsfCallStackContent* CallStackFindEnsembleCsc( const Tcl_CallFrame *framePtr, @@ -122,7 +122,7 @@ const Tcl_Interp *interp, const NsfObject *object, const Tcl_Command cmd -) nonnull(1) nonnull(2) pure; +) nonnull(1) nonnull(2) NSF_pure; static void CallStackReplaceVarTableReferences( const Tcl_Interp *interp,