From e53905d94a0952de627b0d26c1ee06b56bb9b349 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 28 Oct 2008 23:29:54 +0000 Subject: CONSTify TclDTraceInfo Eliminate some -Wstrings-write warnings --- ChangeLog | 8 ++++++++ generic/tclBasic.c | 34 +++++++++++++++++----------------- generic/tclCompile.h | 6 +++--- generic/tclEnv.c | 4 ++-- generic/tclLink.c | 36 ++++++++++++++++++------------------ generic/tclProc.c | 4 ++-- 6 files changed, 50 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3c5542..f02fe4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-22 Jan Nijtmans + + * generic/tclCompile.h: CONSTify TclDTraceInfo + * generic/tclBasic.c + * generic/tclProc.c + * generic/tclEnv.c: Eliminate some -Wstrings-write warnings + * generic/tclLink.c + 2008-10-27 Don Porter * generic/tclEncoding.c: Use "iso8859-1" and not "identity" diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7c42f4a..dbcaecd 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.373 2008/10/19 16:52:18 dkf Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.374 2008/10/28 23:29:54 nijtmans Exp $ */ #include "tclInt.h" @@ -213,10 +213,10 @@ static const CmdInfo builtInCmds[] = { {"upvar", Tcl_UpvarObjCmd, TclCompileUpvarCmd, NULL, 1}, {"variable", Tcl_VariableObjCmd, TclCompileVariableCmd, NULL, 1}, {"while", Tcl_WhileObjCmd, TclCompileWhileCmd, TclNRWhileObjCmd, 1}, - + {"coroutine", NULL, NULL, TclNRCoroutineObjCmd, 1}, {"yield", NULL, NULL, TclNRYieldObjCmd, 1}, - + /* * Commands in the OS-interface. Note that many of these are unsafe. */ @@ -4115,7 +4115,7 @@ TclNREvalObjv( } if (TCL_DTRACE_CMD_INFO_ENABLED() && iPtr->cmdFramePtr) { Tcl_Obj *info = TclInfoFrame(interp, iPtr->cmdFramePtr); - char *a[6]; int i[2]; + const char *a[6]; int i[2]; TclDTraceInfo(info, a, i); TCL_DTRACE_CMD_INFO(a[0], a[1], a[2], a[3], i[0], i[1], a[4], a[5]); @@ -4409,8 +4409,8 @@ TEOV_Exception( * numLevels has not *yet* been decreased, do not call it: do the thing * here directly. */ - - iPtr->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)); + + iPtr->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)); return result; } @@ -5925,10 +5925,10 @@ TEOEx_ByteCodeCallback( } /* - * We are returning to level 0, so should call TclResetCancellation. + * We are returning to level 0, so should call TclResetCancellation. * Let us just unset the flags inline. */ - + iPtr->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)); } iPtr->evalFlags = 0; @@ -7695,7 +7695,7 @@ DTraceObjCmd( void TclDTraceInfo( Tcl_Obj *info, - char **args, + const char **args, int *argsi) { static Tcl_Obj *keys[10] = { NULL }; @@ -7817,7 +7817,7 @@ Tcl_NRCallObjProc( } if (TCL_DTRACE_CMD_INFO_ENABLED() && ((Interp *) interp)->cmdFramePtr) { Tcl_Obj *info = TclInfoFrame(interp, ((Interp *) interp)->cmdFramePtr); - char *a[6]; int i[2]; + const char *a[6]; int i[2]; TclDTraceInfo(info, a, i); TCL_DTRACE_CMD_INFO(a[0], a[1], a[2], a[3], i[0], i[1], a[4], a[5]); @@ -8107,7 +8107,7 @@ TclNRYieldObjCmd( { CoroutineData *corPtr = iPtr->execEnvPtr->corPtr; int numLevels = iPtr->numLevels; - + if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?returnValue?"); return TCL_ERROR; @@ -8125,7 +8125,7 @@ TclNRYieldObjCmd( iPtr->numLevels = corPtr->auxNumLevels; corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels; - + TclNRAddCallback(interp, NRCallTEBC, INT2PTR(TCL_NR_YIELD_TYPE), NULL, NULL, NULL); return TCL_OK; @@ -8165,7 +8165,7 @@ DeleteCoroutine( CoroutineData *corPtr = clientData; Tcl_Interp *interp = corPtr->eePtr->interp; TEOV_callback *rootPtr = TOP_CB(interp); - + if (COR_IS_SUSPENDED(corPtr)) { TclNRRunCallbacks(interp, RewindCoroutine(corPtr,TCL_OK), rootPtr, 0); } @@ -8311,7 +8311,7 @@ NRInterpCoroutine( { CoroutineData *corPtr = clientData; int nestNumLevels = corPtr->auxNumLevels; - + if ((objc != 1) && (objc != 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?arg?"); return TCL_ERROR; @@ -8408,7 +8408,7 @@ TclNRCoroutineObjCmd( * On first run just set a 0 level-offset, the natural numbering is * correct. The offset will be fixed for later runs. */ - + Tcl_DStringInit(&ds); if (nsPtr != iPtr->globalNsPtr) { Tcl_DStringAppend(&ds, nsPtr->fullName, -1); @@ -8474,7 +8474,7 @@ TclNRCoroutineObjCmd( iPtr->varFramePtr = iPtr->rootFramePtr; iPtr->lookupNsPtr = iPtr->framePtr->nsPtr; corPtr->auxNumLevels = iPtr->numLevels; - + TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, NULL,NULL,NULL); return TclNRRunCallbacks(interp, TclNREvalObjEx(interp, cmdObjPtr, 0, NULL, 0), rootPtr, 0); @@ -8498,7 +8498,7 @@ TclInfoCoroutineCmd( return TCL_ERROR; } - if (corPtr && !(corPtr->cmdPtr->flags & CMD_IS_DELETED)) { + if (corPtr && !(corPtr->cmdPtr->flags & CMD_IS_DELETED)) { Tcl_Obj *namePtr; TclNewObj(namePtr); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 2ef278f..f42247d 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.h,v 1.112 2008/10/22 20:23:59 nijtmans Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.113 2008/10/28 23:29:54 nijtmans Exp $ */ #ifndef _TCLCOMPILATION @@ -1292,7 +1292,7 @@ MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr, #define TCL_DTRACE_DEBUG_LOG() -MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, char **args, int *argsi); +MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi); #else /* USE_DTRACE */ @@ -1347,7 +1347,7 @@ MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, char **args, int *argsi); MODULE_SCOPE int tclDTraceDebugEnabled, tclDTraceDebugIndent; MODULE_SCOPE FILE *tclDTraceDebugLog; MODULE_SCOPE void TclDTraceOpenDebugLog(void); -MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, char **args, int *argsi); +MODULE_SCOPE void TclDTraceInfo(Tcl_Obj *info, const char **args, int *argsi); #define TCL_DTRACE_DEBUG_LOG() \ int tclDTraceDebugEnabled = TCL_DTRACE_DEBUG_LOG_ENABLED;\ diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 49238a2..3a7a3c8 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEnv.c,v 1.37 2007/12/13 15:23:16 dgp Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.38 2008/10/28 23:29:54 nijtmans Exp $ */ #include "tclInt.h" @@ -562,7 +562,7 @@ EnvTraceProc( const char *value = TclGetEnv(name2, &valueString); if (value == NULL) { - return "no such variable"; + return (char *) "no such variable"; } Tcl_SetVar2(interp, name1, name2, value, 0); Tcl_DStringFree(&valueString); diff --git a/generic/tclLink.c b/generic/tclLink.c index d4a7f38..b2d236b 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLink.c,v 1.25 2008/04/27 22:21:30 dkf Exp $ + * RCS: @(#) $Id: tclLink.c,v 1.26 2008/10/28 23:29:54 nijtmans Exp $ */ #include "tclInt.h" @@ -337,7 +337,7 @@ LinkTraceProc( changed = 1; break; default: - return "internal error: bad linked variable type"; + return (char *) "internal error: bad linked variable type"; } if (changed) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), @@ -358,7 +358,7 @@ LinkTraceProc( if (linkPtr->flags & LINK_READ_ONLY) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "linked variable is read-only"; + return (char *) "linked variable is read-only"; } valueObj = Tcl_ObjGetVar2(interp, linkPtr->varName,NULL, TCL_GLOBAL_ONLY); if (valueObj == NULL) { @@ -366,7 +366,7 @@ LinkTraceProc( * This shouldn't ever happen. */ - return "internal error: linked variable couldn't be read"; + return (char *) "internal error: linked variable couldn't be read"; } switch (linkPtr->type) { @@ -375,7 +375,7 @@ LinkTraceProc( != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have integer value"; + return (char *) "variable must have integer value"; } LinkedVar(int) = linkPtr->lastValue.i; break; @@ -385,7 +385,7 @@ LinkTraceProc( != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have integer value"; + return (char *) "variable must have integer value"; } LinkedVar(Tcl_WideInt) = linkPtr->lastValue.w; break; @@ -398,7 +398,7 @@ LinkTraceProc( #endif Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have real value"; + return (char *) "variable must have real value"; #ifdef ACCEPT_NAN } linkPtr->lastValue.d = valueObj->internalRep.doubleValue; @@ -412,7 +412,7 @@ LinkTraceProc( != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have boolean value"; + return (char *) "variable must have boolean value"; } LinkedVar(int) = linkPtr->lastValue.i; break; @@ -422,7 +422,7 @@ LinkTraceProc( || valueInt < SCHAR_MIN || valueInt > SCHAR_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have char value"; + return (char *) "variable must have char value"; } linkPtr->lastValue.c = (char)valueInt; LinkedVar(char) = linkPtr->lastValue.c; @@ -433,7 +433,7 @@ LinkTraceProc( || valueInt < 0 || valueInt > UCHAR_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have unsigned char value"; + return (char *) "variable must have unsigned char value"; } linkPtr->lastValue.uc = (unsigned char) valueInt; LinkedVar(unsigned char) = linkPtr->lastValue.uc; @@ -444,7 +444,7 @@ LinkTraceProc( || valueInt < SHRT_MIN || valueInt > SHRT_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have short value"; + return (char *) "variable must have short value"; } linkPtr->lastValue.s = (short)valueInt; LinkedVar(short) = linkPtr->lastValue.s; @@ -455,7 +455,7 @@ LinkTraceProc( || valueInt < 0 || valueInt > USHRT_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have unsigned short value"; + return (char *) "variable must have unsigned short value"; } linkPtr->lastValue.us = (unsigned short)valueInt; LinkedVar(unsigned short) = linkPtr->lastValue.us; @@ -466,7 +466,7 @@ LinkTraceProc( || valueWide < 0 || valueWide > UINT_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have unsigned int value"; + return (char *) "variable must have unsigned int value"; } linkPtr->lastValue.ui = (unsigned int)valueWide; LinkedVar(unsigned int) = linkPtr->lastValue.ui; @@ -477,7 +477,7 @@ LinkTraceProc( || valueWide < LONG_MIN || valueWide > LONG_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have long value"; + return (char *) "variable must have long value"; } linkPtr->lastValue.l = (long)valueWide; LinkedVar(long) = linkPtr->lastValue.l; @@ -488,7 +488,7 @@ LinkTraceProc( || valueWide < 0 || (Tcl_WideUInt) valueWide > ULONG_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have unsigned long value"; + return (char *) "variable must have unsigned long value"; } linkPtr->lastValue.ul = (unsigned long)valueWide; LinkedVar(unsigned long) = linkPtr->lastValue.ul; @@ -501,7 +501,7 @@ LinkTraceProc( if (Tcl_GetWideIntFromObj(interp, valueObj, &valueWide) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have unsigned wide int value"; + return (char *) "variable must have unsigned wide int value"; } linkPtr->lastValue.uw = (Tcl_WideUInt)valueWide; LinkedVar(Tcl_WideUInt) = linkPtr->lastValue.uw; @@ -512,7 +512,7 @@ LinkTraceProc( || valueDouble < -FLT_MAX || valueDouble > FLT_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); - return "variable must have float value"; + return (char *) "variable must have float value"; } linkPtr->lastValue.f = (float)valueDouble; LinkedVar(float) = linkPtr->lastValue.f; @@ -528,7 +528,7 @@ LinkTraceProc( break; default: - return "internal error: bad linked variable type"; + return (char *) "internal error: bad linked variable type"; } return NULL; } diff --git a/generic/tclProc.c b/generic/tclProc.c index e116e92..a7e9531 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.166 2008/10/19 19:55:37 dgp Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.167 2008/10/28 23:29:54 nijtmans Exp $ */ #include "tclInt.h" @@ -1766,7 +1766,7 @@ TclNRInterpProcCore( } if (TCL_DTRACE_PROC_INFO_ENABLED() && iPtr->cmdFramePtr) { Tcl_Obj *info = TclInfoFrame(interp, iPtr->cmdFramePtr); - char *a[6]; int i[2]; + const char *a[6]; int i[2]; TclDTraceInfo(info, a, i); TCL_DTRACE_PROC_INFO(a[0], a[1], a[2], a[3], i[0], i[1], a[4], a[5]); -- cgit v0.12