summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-28 09:59:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-28 09:59:26 (GMT)
commite9a4ca4f22d40f304a6f50f9b410651ce75098cd (patch)
treead06f7fd343e736e4c770b30530f1f93b1c4f587 /generic
parentaab801db76cd9d4f54a978ebbd1eed7a0ee05c4a (diff)
downloadtcl-e9a4ca4f22d40f304a6f50f9b410651ce75098cd.zip
tcl-e9a4ca4f22d40f304a6f50f9b410651ce75098cd.tar.gz
tcl-e9a4ca4f22d40f304a6f50f9b410651ce75098cd.tar.bz2
Add /* FALLTHRU */ markers in various places (silencing possible GCC warnings). Eliminate some more "register" keywords. Eliminate (or silence) some unused function parameters.
Diffstat (limited to 'generic')
-rw-r--r--generic/regc_lex.c4
-rw-r--r--generic/regc_nfa.c6
-rw-r--r--generic/regcomp.c26
-rw-r--r--generic/regcustom.h4
-rw-r--r--generic/regerror.c1
-rw-r--r--generic/regex.h4
-rw-r--r--generic/regexec.c8
-rw-r--r--generic/regguts.h2
-rw-r--r--generic/tclAssembly.c13
-rw-r--r--generic/tclBasic.c2
-rw-r--r--generic/tclCkalloc.c12
-rw-r--r--generic/tclClock.c5
-rw-r--r--generic/tclCmdMZ.c1
-rw-r--r--generic/tclCompile.h8
-rw-r--r--generic/tclDictObj.c1
-rw-r--r--generic/tclExecute.c5
-rw-r--r--generic/tclOOInt.h2
-rw-r--r--generic/tclProc.c4
-rw-r--r--generic/tclRegexp.c4
-rw-r--r--generic/tclScan.c11
-rw-r--r--generic/tclStringObj.c2
21 files changed, 65 insertions, 60 deletions
diff --git a/generic/regc_lex.c b/generic/regc_lex.c
index affcb48..fba2fc7 100644
--- a/generic/regc_lex.c
+++ b/generic/regc_lex.c
@@ -905,9 +905,7 @@ lexescape(
v->now = save;
- /*
- * And fall through into octal number.
- */
+ /* FALLTHRU */
case CHR('0'):
NOTE(REG_UUNPORT);
diff --git a/generic/regc_nfa.c b/generic/regc_nfa.c
index 088c6c0..7f43958 100644
--- a/generic/regc_nfa.c
+++ b/generic/regc_nfa.c
@@ -2978,6 +2978,9 @@ dumpnfa(
dumpcolors(nfa->cm, f);
}
fflush(f);
+#else
+ (void)nfa;
+ (void)f;
#endif
}
@@ -3157,6 +3160,9 @@ dumpcnfa(
dumpcstate(st, cnfa, f);
}
fflush(f);
+#else
+ (void)cnfa;
+ (void)f;
#endif
}
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 211cd70..3051446 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -59,7 +59,6 @@ static void wordchrs(struct vars *);
static struct subre *subre(struct vars *, int, int, struct state *, struct state *);
static void freesubre(struct vars *, struct subre *);
static void freesrnode(struct vars *, struct subre *);
-static void optst(struct vars *, struct subre *);
static int numst(struct subre *, int);
static void markst(struct subre *);
static void cleanst(struct vars *);
@@ -395,7 +394,6 @@ compile(
dumpnfa(v->nfa, debug);
dumpst(v->tree, debug, 1);
}
- optst(v, v->tree);
v->ntree = numst(v->tree, 1);
markst(v->tree);
cleanst(v);
@@ -923,7 +921,7 @@ parseqatom(
*/
NOTE(REG_UPBOTCH);
- /* fallthrough into case PLAIN */
+ /* FALLTHRU */
case PLAIN:
onechr(v, v->nextvalue, lp, rp);
okcolors(v->nfa, v->cm);
@@ -1812,25 +1810,6 @@ freesrnode(
}
/*
- - optst - optimize a subRE subtree
- ^ static void optst(struct vars *, struct subre *);
- */
-static void
-optst(
- struct vars *v,
- struct subre *t)
-{
- /*
- * DGP (2007-11-13): I assume it was the programmer's intent to eventually
- * come back and add code to optimize subRE trees, but the routine coded
- * just spends effort traversing the tree and doing nothing. We can do
- * nothing with less effort.
- */
-
- return;
-}
-
-/*
- numst - number tree nodes (assigning "id" indexes)
^ static int numst(struct subre *, int);
*/
@@ -2101,6 +2080,9 @@ dump(
}
fprintf(f, "\n");
dumpst(g->tree, f, 0);
+#else
+ (void)re;
+ (void)f;
#endif
}
diff --git a/generic/regcustom.h b/generic/regcustom.h
index 681b97d..e7bdca7 100644
--- a/generic/regcustom.h
+++ b/generic/regcustom.h
@@ -132,7 +132,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#if 1
#define AllocVars(vPtr) \
static Tcl_ThreadDataKey varsKey; \
- register struct vars *vPtr = (struct vars *) \
+ struct vars *vPtr = (struct vars *) \
Tcl_GetThreadData(&varsKey, sizeof(struct vars))
#else
/*
@@ -141,7 +141,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
* faster in practice (measured!)
*/
#define AllocVars(vPtr) \
- register struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars))
+ struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars))
#define FreeVars(vPtr) \
FREE(vPtr)
#endif
diff --git a/generic/regerror.c b/generic/regerror.c
index 49d93ed..f783217 100644
--- a/generic/regerror.c
+++ b/generic/regerror.c
@@ -58,7 +58,6 @@ static const struct rerr {
size_t /* Actual space needed (including NUL) */
regerror(
int code, /* Error code, or REG_ATOI or REG_ITOA */
- const regex_t *preg, /* Associated regex_t (unused at present) */
char *errbuf, /* Result buffer (unless errbuf_size==0) */
size_t errbuf_size) /* Available space in errbuf, can be 0 */
{
diff --git a/generic/regex.h b/generic/regex.h
index 8845f72..adbd098 100644
--- a/generic/regex.h
+++ b/generic/regex.h
@@ -232,7 +232,7 @@ typedef struct {
* of character is used for error reports is independent of what kind is used
* in matching.
*
- ^ extern size_t regerror(int, const regex_t *, char *, size_t);
+ ^ extern size_t regerror(int, char *, size_t);
*/
#define REG_OKAY 0 /* no errors detected */
#define REG_NOMATCH 1 /* failed to match */
@@ -283,7 +283,7 @@ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
MODULE_SCOPE void regfree(regex_t *);
-MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
+MODULE_SCOPE size_t regerror(int, char *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
diff --git a/generic/regexec.c b/generic/regexec.c
index 6d12827..f174420 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -129,7 +129,7 @@ int exec(regex_t *, const chr *, size_t, rm_detail_t *, size_t, regmatch_t [], i
static struct dfa *getsubdfa(struct vars *, struct subre *);
static int simpleFind(struct vars *const, struct cnfa *const, struct colormap *const);
static int complicatedFind(struct vars *const, struct cnfa *const, struct colormap *const);
-static int complicatedFindLoop(struct vars *const, struct cnfa *const, struct colormap *const, struct dfa *const, struct dfa *const, chr **const);
+static int complicatedFindLoop(struct vars *const, struct dfa *const, struct dfa *const, chr **const);
static void zapallsubs(regmatch_t *const, const size_t);
static void zaptreesubs(struct vars *const, struct subre *const);
static void subset(struct vars *const, struct subre *const, chr *const, chr *const);
@@ -434,7 +434,7 @@ complicatedFind(
return v->err;
}
- ret = complicatedFindLoop(v, cnfa, cm, d, s, &cold);
+ ret = complicatedFindLoop(v, d, s, &cold);
freeDFA(d);
freeDFA(s);
@@ -453,14 +453,12 @@ complicatedFind(
/*
- complicatedFindLoop - the heart of complicatedFind
- ^ static int complicatedFindLoop(struct vars *, struct cnfa *, struct colormap *,
+ ^ static int complicatedFindLoop(struct vars *,
^ struct dfa *, struct dfa *, chr **);
*/
static int
complicatedFindLoop(
struct vars *const v,
- struct cnfa *const cnfa,
- struct colormap *const cm,
struct dfa *const d,
struct dfa *const s,
chr **const coldp) /* where to put coldstart pointer */
diff --git a/generic/regguts.h b/generic/regguts.h
index 1ac2465..e10711d 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -438,7 +438,7 @@ struct guts {
#ifndef AllocVars
#define AllocVars(vPtr) \
struct vars var; \
- register struct vars *vPtr = &var
+ struct vars *vPtr = &var
#endif
#ifndef FreeVars
#define FreeVars(vPtr) ((void) 0)
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 39930a7..f05814fa 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -287,8 +287,7 @@ static int GetIntegerOperand(AssemblyEnv*, Tcl_Token**, int*);
static int GetNextOperand(AssemblyEnv*, Tcl_Token**, Tcl_Obj**);
static void LookForFreshCatches(BasicBlock*, BasicBlock**);
static void MoveCodeForJumps(AssemblyEnv*, int);
-static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int,
- int);
+static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int);
static AssemblyEnv* NewAssemblyEnv(CompileEnv*, int);
static int ProcessCatches(AssemblyEnv*);
static int ProcessCatchesInBasicBlock(AssemblyEnv*, BasicBlock*,
@@ -784,6 +783,7 @@ TclNRAssembleObjCmd(
Tcl_Obj* backtrace; /* Object where extra error information is
* constructed. */
+ (void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bytecodeList");
return TCL_ERROR;
@@ -959,7 +959,7 @@ TclCompileAssembleCmd(
int numCommands = envPtr->numCommands;
int offset = envPtr->codeNext - envPtr->codeStart;
int depth = envPtr->currStackDepth;
-
+ (void)cmdPtr;
/*
* Make sure that the command has a single arg that is a simple word.
*/
@@ -1808,7 +1808,6 @@ CompileEmbeddedScript(
int savedStackDepth = envPtr->currStackDepth;
int savedMaxStackDepth = envPtr->maxStackDepth;
- int savedCodeIndex = envPtr->codeNext - envPtr->codeStart;
int savedExceptArrayNext = envPtr->exceptArrayNext;
envPtr->currStackDepth = 0;
@@ -1841,8 +1840,7 @@ CompileEmbeddedScript(
* need to be fixed up once the stack depth is known.
*/
- MoveExceptionRangesToBasicBlock(assemEnvPtr, savedCodeIndex,
- savedExceptArrayNext);
+ MoveExceptionRangesToBasicBlock(assemEnvPtr, savedExceptArrayNext);
/*
* Flush the current basic block.
@@ -1901,7 +1899,6 @@ SyncStackDepth(
static void
MoveExceptionRangesToBasicBlock(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
- int savedCodeIndex, /* Start of the embedded code */
int savedExceptArrayNext) /* Saved index of the end of the exception
* range array */
{
@@ -4310,6 +4307,8 @@ DupAssembleCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
{
+ (void)srcPtr;
+ (void)copyPtr;
return;
}
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 62e7e04..53d1158 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -6510,8 +6510,8 @@ Tcl_ExprLongObj(
return TCL_ERROR;
}
resultPtr = Tcl_NewBignumObj(&big);
- /* FALLTHROUGH */
}
+ /* FALLTHRU */
case TCL_NUMBER_LONG:
case TCL_NUMBER_WIDE:
case TCL_NUMBER_BIG:
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 70e64f0..26f092f 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -1119,6 +1119,8 @@ Tcl_AttemptDbCkalloc(
int line)
{
char *result;
+ (void)file;
+ (void)line;
result = (char *) TclpAlloc(size);
return result;
@@ -1198,6 +1200,8 @@ Tcl_AttemptDbCkrealloc(
int line)
{
char *result;
+ (void)file;
+ (void)line;
result = (char *) TclpRealloc(ptr, size);
return result;
@@ -1228,6 +1232,8 @@ Tcl_DbCkfree(
const char *file,
int line)
{
+ (void)file;
+ (void)line;
TclpFree(ptr);
}
@@ -1246,12 +1252,14 @@ void
Tcl_InitMemory(
Tcl_Interp *interp)
{
+ (void)interp;
}
int
Tcl_DumpActiveMemory(
const char *fileName)
{
+ (void)fileName;
return TCL_OK;
}
@@ -1260,6 +1268,8 @@ Tcl_ValidateAllMemory(
const char *file,
int line)
{
+ (void)file;
+ (void)line;
}
int
@@ -1267,6 +1277,8 @@ TclDumpMemoryInfo(
ClientData clientData,
int flags)
{
+ (void)clientData;
+ (void)flags;
return 1;
}
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 9ed970c..0e8a941 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -1652,6 +1652,7 @@ ClockGetenvObjCmd(
{
const char *varName;
const char *varValue;
+ (void)clientData;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -1744,6 +1745,7 @@ ClockClicksObjCmd(
int index = CLICKS_NATIVE;
Tcl_Time now;
Tcl_WideInt clicks = 0;
+ (void)clientData;
switch (objc) {
case 1:
@@ -1806,6 +1808,7 @@ ClockMillisecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
+ (void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1842,6 +1845,7 @@ ClockMicrosecondsObjCmd(
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
+ (void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -1994,6 +1998,7 @@ ClockSecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
+ (void)clientData;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index ae10e74..193eac4 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -4578,6 +4578,7 @@ Tcl_TimeRateObjCmd(
*/
threshold = 1;
maxcnt = 0;
+ /* FALLTHRU */
case TCL_CONTINUE:
result = TCL_OK;
break;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index aa6d247..1d657a7 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1164,14 +1164,14 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp,
static inline void
TclPreserveByteCode(
- register ByteCode *codePtr)
+ ByteCode *codePtr)
{
codePtr->refCount++;
}
static inline void
TclReleaseByteCode(
- register ByteCode *codePtr)
+ ByteCode *codePtr)
{
if (codePtr->refCount-- > 1) {
return;
@@ -1209,7 +1209,7 @@ MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp,
const unsigned char *pc, Tcl_Obj **tosPtr);
MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
- register Tcl_Interp *interp, int objc,
+ Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], int isLambda);
@@ -1420,7 +1420,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
#define TclEmitPush(objIndex, envPtr) \
do { \
- register int _objIndexCopy = (objIndex); \
+ int _objIndexCopy = (objIndex); \
if (_objIndexCopy <= 255) { \
TclEmitInstInt1(INST_PUSH1, _objIndexCopy, (envPtr)); \
} else { \
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 32234a3..a42c123 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -3083,6 +3083,7 @@ DictFilterCmd(
Tcl_ResetResult(interp);
Tcl_DictObjDone(&search);
+ /* FALLTHRU */
case TCL_CONTINUE:
result = TCL_OK;
break;
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 779f4a2..c5f5c0c 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2286,10 +2286,12 @@ TEBCresume(
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
}
+ /* FALLTHRU */
case 2:
cleanup2_pushObjResultPtr:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 1:
cleanup1_pushObjResultPtr:
objPtr = OBJ_AT_TOS;
@@ -2306,14 +2308,17 @@ TEBCresume(
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
}
+ /* FALLTHRU */
case 2:
cleanup2:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 1:
cleanup1:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 0:
/*
* We really want to do nothing now, but this is needed for some
diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h
index d90b407..436acd6 100644
--- a/generic/tclOOInt.h
+++ b/generic/tclOOInt.h
@@ -590,7 +590,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
#undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */
#define DUPLICATE(target,source,type) \
do { \
- register unsigned len = sizeof(type) * ((target).num=(source).num);\
+ size_t len = sizeof(type) * ((target).num=(source).num);\
if (len != 0) { \
memcpy(((target).list=(type*)ckalloc(len)), (source).list, len); \
} else { \
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 03cb0f0..06ca565 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -1835,9 +1835,7 @@ InterpProcNR2(
Tcl_SetErrorCode(interp, "TCL", "RESULT", "UNEXPECTED", NULL);
result = TCL_ERROR;
- /*
- * Fall through to the TCL_ERROR handling code.
- */
+ /* FALLTHRU */
case TCL_ERROR:
/*
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index cfe6388..19ff8fd 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -726,12 +726,12 @@ TclRegError(
const char *p;
Tcl_ResetResult(interp);
- n = TclReError(status, NULL, buf, sizeof(buf));
+ n = TclReError(status, buf, sizeof(buf));
p = (n > sizeof(buf)) ? "..." : "";
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s%s%s", msg, buf, p));
sprintf(cbuf, "%d", status);
- (void) TclReError(REG_ITOA, NULL, cbuf, sizeof(cbuf));
+ (void) TclReError(REG_ITOA, cbuf, sizeof(cbuf));
Tcl_SetErrorCode(interp, "REGEXP", cbuf, buf, NULL);
}
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 1ff83af..b0669ab 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -362,8 +362,10 @@ ValidateFormat(
format += TclUtfToUniChar(format, &ch);
break;
}
+ /* FALLTHRU */
case 'L':
flags |= SCAN_LONGER;
+ /* FALLTHRU */
case 'h':
format += TclUtfToUniChar(format, &ch);
}
@@ -385,9 +387,7 @@ ValidateFormat(
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADWIDTH", NULL);
goto error;
}
- /*
- * Fall through!
- */
+ /* FALLTHRU */
case 'n':
case 's':
if (flags & (SCAN_LONGER|SCAN_BIG)) {
@@ -709,11 +709,10 @@ Tcl_ScanObjCmd(
format += TclUtfToUniChar(format, &ch);
break;
}
+ /* FALLTHRU */
case 'L':
flags |= SCAN_LONGER;
- /*
- * Fall through so we skip to the next character.
- */
+ /* FALLTHRU */
case 'h':
format += TclUtfToUniChar(format, &ch);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index ad578b1..e4db140 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2019,6 +2019,7 @@ Tcl_AppendFormatToObj(
errCode = "BADUNSIGNED";
goto errorMsg;
}
+ /* FALLTHRU */
case 'd':
case 'o':
case 'x':
@@ -2616,6 +2617,7 @@ AppendPrintfToObjVA(
break;
case 'h':
size = -1;
+ /* FALLTHRU */
default:
p++;
}