summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-27 13:18:51 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-27 13:18:51 (GMT)
commitd63bdddac575b06d8dbaff5caf199f191258281a (patch)
tree81621affdfd50f3451faa2c5568732111932e247
parent4761295d5dc11e76a759fc26de4b30d09bccd1a5 (diff)
downloadtcl-d63bdddac575b06d8dbaff5caf199f191258281a.zip
tcl-d63bdddac575b06d8dbaff5caf199f191258281a.tar.gz
tcl-d63bdddac575b06d8dbaff5caf199f191258281a.tar.bz2
Made compiling with -Wstrict-prototypes -Wmissing-prototypes much cleaner.
Also added support for [FRQ 951168] but left that switched off by default.
-rw-r--r--ChangeLog21
-rw-r--r--generic/tclCmdMZ.c18
-rw-r--r--generic/tclDictObj.c3
-rw-r--r--generic/tclHash.c8
-rw-r--r--generic/tclScan.c26
-rw-r--r--generic/tclVar.c7
-rw-r--r--unix/tclUnixChan.c6
-rw-r--r--unix/tclUnixPort.h4
-rw-r--r--unix/tclUnixTest.c7
-rw-r--r--unix/tclUnixThrd.c4
10 files changed, 71 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index aa9a0b4..d67c0a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2004-05-27 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tclHash.c (CompareStringKeys): Added #ifdef to allow
+ people to instruct this function to use strcmp(). [FRQ 951168]
+
+ * generic/tclVar.c: Moved declarations into #if guards so they
+ only happen when required.
+ * unix/tclUnixPort.h: Guard declaration of strtod() so it is only
+ enabled when we don't have a declaration in stdlib.h
+ * unix/tclUnixThrd.c (Tcl_CreateThread): Added declarations
+ * unix/tclUnixTest.c (AlarmHandler): and casts so that
+ * unix/tclUnixChan.c (TtyModemStatusStr): all functions are
+ * generic/tclScan.c (Tcl_ScanObjCmd): defined before use
+ * generic/tclDictObj.c (InvalidateDictChain): and no cross-type
+ * generic/tclCmdMZ.c (Tcl_StringObjCmd): uses are performed.
+
+ The overall effect is to make building with gcc with the
+ additional flags -Wstrict-prototypes -Wmissing-prototypes produce
+ no increase in the total number of warnings (except for main(),
+ which is undeclared for traditional reasons.)
+
2004-05-26 Jeff Hobbs <jeffh@ActiveState.com>
* unix/Makefile.in: Rework configure ordering to TCL_LINK_LIBS,
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 0e0bffc..17620d2 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.101 2004/04/06 22:25:49 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.102 2004/05/27 13:18:52 dkf Exp $
*/
#include "tclInt.h"
@@ -1325,12 +1325,14 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
* comparison in INST_EQ/INST_NEQ/INST_LT/...).
*/
int i, match, length, nocase = 0, reqlength = -1;
- int (*strCmpFn)();
+ typedef int (*strCmpFn_t) _ANSI_ARGS_((const char *, const char *,
+ unsigned int));
+ strCmpFn_t strCmpFn;
if (objc < 4 || objc > 7) {
str_cmp_args:
Tcl_WrongNumArgs(interp, 2, objv,
- "?-nocase? ?-length int? string1 string2");
+ "?-nocase? ?-length int? string1 string2");
return TCL_ERROR;
}
@@ -1381,7 +1383,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
*/
string1 = (char*) Tcl_GetByteArrayFromObj(objv[0], &length1);
string2 = (char*) Tcl_GetByteArrayFromObj(objv[1], &length2);
- strCmpFn = memcmp;
+ strCmpFn = (strCmpFn_t) memcmp;
} else if ((objv[0]->typePtr == &tclStringType)
&& (objv[1]->typePtr == &tclStringType)) {
/*
@@ -1392,7 +1394,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
*/
string1 = (char*) Tcl_GetUnicodeFromObj(objv[0], &length1);
string2 = (char*) Tcl_GetUnicodeFromObj(objv[1], &length2);
- strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp;
+ strCmpFn = (strCmpFn_t)
+ (nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp);
} else {
/*
* As a catch-all we will work with UTF-8. We cannot use
@@ -1404,11 +1407,12 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
string1 = (char*) Tcl_GetStringFromObj(objv[0], &length1);
string2 = (char*) Tcl_GetStringFromObj(objv[1], &length2);
if ((reqlength < 0) && !nocase) {
- strCmpFn = TclpUtfNcmp2;
+ strCmpFn = (strCmpFn_t) TclpUtfNcmp2;
} else {
length1 = Tcl_NumUtfChars(string1, length1);
length2 = Tcl_NumUtfChars(string2, length2);
- strCmpFn = nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp;
+ strCmpFn = (strCmpFn_t)
+ (nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp);
}
}
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index bbbc156..c29ac40 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -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: tclDictObj.c,v 1.15 2004/03/12 23:21:05 dkf Exp $
+ * RCS: @(#) $Id: tclDictObj.c,v 1.16 2004/05/27 13:18:53 dkf Exp $
*/
#include "tclInt.h"
@@ -73,6 +73,7 @@ static int DictValuesCmd _ANSI_ARGS_((Tcl_Interp *interp,
static void DupDictInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr));
static void FreeDictInternalRep _ANSI_ARGS_((Tcl_Obj *dictPtr));
+static void InvalidateDictChain _ANSI_ARGS_((Tcl_Obj *dictObj));
static int SetDictFromAny _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
static void UpdateStringOfDict _ANSI_ARGS_((Tcl_Obj *dictPtr));
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 54a6efa..360acfe 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.18 2004/04/06 22:25:51 dgp Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.19 2004/05/27 13:18:53 dkf Exp $
*/
#include "tclInt.h"
@@ -986,11 +986,14 @@ AllocStringEntry(tablePtr, keyPtr)
static int
CompareStringKeys(keyPtr, hPtr)
VOID *keyPtr; /* New key to compare. */
- Tcl_HashEntry *hPtr; /* Existing key to compare. */
+ Tcl_HashEntry *hPtr; /* Existing key to compare. */
{
register CONST char *p1 = (CONST char *) keyPtr;
register CONST char *p2 = (CONST char *) hPtr->key.string;
+#ifdef TCL_COMPARE_HASHES_WITH_STRCMP
+ return !strcmp(p1, p2);
+#else
for (;; p1++, p2++) {
if (*p1 != *p2) {
break;
@@ -1000,6 +1003,7 @@ CompareStringKeys(keyPtr, hPtr)
}
}
return 0;
+#endif /* TCL_COMPARE_HASHES_WITH_STRCMP */
}
/*
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 2ff616d..47d40bd 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclScan.c,v 1.13 2004/04/06 22:25:54 dgp Exp $
+ * RCS: @(#) $Id: tclScan.c,v 1.14 2004/05/27 13:18:53 dkf Exp $
*/
#include "tclInt.h"
@@ -575,9 +575,9 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv)
int base = 0;
int underflow = 0;
size_t width;
- long (*fn)() = NULL;
+ long (*fn) _ANSI_ARGS_((char*,void*,int)) = NULL;
#ifndef TCL_WIDE_INT_IS_LONG
- Tcl_WideInt (*lfn)() = NULL;
+ Tcl_WideInt (*lfn) _ANSI_ARGS_((char*,void*,int)) = NULL;
Tcl_WideInt wideValue;
#endif
Tcl_UniChar ch, sch;
@@ -727,42 +727,42 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv)
case 'd':
op = 'i';
base = 10;
- fn = (long (*)())strtol;
+ fn = (long (*) _ANSI_ARGS_((char*,void*,int)))strtol;
#ifndef TCL_WIDE_INT_IS_LONG
- lfn = (Tcl_WideInt (*)())strtoll;
+ lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoll;
#endif
break;
case 'i':
op = 'i';
base = 0;
- fn = (long (*)())strtol;
+ fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtol;
#ifndef TCL_WIDE_INT_IS_LONG
- lfn = (Tcl_WideInt (*)())strtoll;
+ lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoll;
#endif
break;
case 'o':
op = 'i';
base = 8;
- fn = (long (*)())strtoul;
+ fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul;
#ifndef TCL_WIDE_INT_IS_LONG
- lfn = (Tcl_WideInt (*)())strtoull;
+ lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull;
#endif
break;
case 'x':
op = 'i';
base = 16;
- fn = (long (*)())strtoul;
+ fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul;
#ifndef TCL_WIDE_INT_IS_LONG
- lfn = (Tcl_WideInt (*)())strtoull;
+ lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull;
#endif
break;
case 'u':
op = 'i';
base = 10;
flags |= SCAN_UNSIGNED;
- fn = (long (*)())strtoul;
+ fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul;
#ifndef TCL_WIDE_INT_IS_LONG
- lfn = (Tcl_WideInt (*)())strtoull;
+ lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull;
#endif
break;
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 667c206..2a88366 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.83 2004/05/25 19:45:16 msofer Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.84 2004/05/27 13:18:53 dkf Exp $
*/
#include "tclInt.h"
@@ -69,8 +69,6 @@ int TclObjUnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
static Tcl_FreeInternalRepProc FreeLocalVarName;
static Tcl_DupInternalRepProc DupLocalVarName;
static Tcl_UpdateStringProc UpdateLocalVarName;
-static Tcl_FreeInternalRepProc FreeNsVarName;
-static Tcl_DupInternalRepProc DupNsVarName;
static Tcl_FreeInternalRepProc FreeParsedVarName;
static Tcl_DupInternalRepProc DupParsedVarName;
static Tcl_UpdateStringProc UpdateParsedVarName;
@@ -111,6 +109,9 @@ Tcl_ObjType tclLocalVarNameType = {
#define ENABLE_NS_VARNAME_CACHING 0
#if ENABLE_NS_VARNAME_CACHING
+static Tcl_FreeInternalRepProc FreeNsVarName;
+static Tcl_DupInternalRepProc DupNsVarName;
+
Tcl_ObjType tclNsVarNameType = {
"namespaceVarName",
FreeNsVarName, DupNsVarName, NULL, NULL
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 484b649..4a2e7b2 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.49 2004/05/04 03:52:28 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.50 2004/05/27 13:18:54 dkf Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -274,10 +274,14 @@ static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData,
Tcl_Interp *interp));
static void TtyGetAttributes _ANSI_ARGS_((int fd,
TtyAttrs *ttyPtr));
+static int TtyGetBaud _ANSI_ARGS_((unsigned long speed));
static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData,
Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *dsPtr));
+static unsigned long TtyGetSpeed _ANSI_ARGS_((int baud));
static FileState * TtyInit _ANSI_ARGS_((int fd, int initialize));
+static void TtyModemStatusStr _ANSI_ARGS_((int status,
+ Tcl_DString *dsPtr));
#if BAD_TIP35_FLUSH
static int TtyOutputProc _ANSI_ARGS_((ClientData instanceData,
CONST char *buf, int toWrite, int *errorCode));
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index 8bb93bf..4000de6 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -19,7 +19,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixPort.h,v 1.36 2004/05/14 21:43:29 kennykb Exp $
+ * RCS: @(#) $Id: tclUnixPort.h,v 1.37 2004/05/27 13:18:55 dkf Exp $
*/
#ifndef _TCLUNIXPORT
@@ -493,7 +493,9 @@ extern char **environ;
* up being too many conflicts with slightly-different prototypes.
*/
+#ifdef NO_STDLIB_H
extern double strtod();
+#endif
/*
* There is no platform-specific panic routine for Unix in the Tcl internals.
diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c
index 880e4fd..f3414f5 100644
--- a/unix/tclUnixTest.c
+++ b/unix/tclUnixTest.c
@@ -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: tclUnixTest.c,v 1.16 2004/04/06 22:25:57 dgp Exp $
+ * RCS: @(#) $Id: tclUnixTest.c,v 1.17 2004/05/27 13:18:55 dkf Exp $
*/
#include "tclInt.h"
@@ -81,7 +81,7 @@ static int TestalarmCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv));
static int TestgotsigCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv));
-static void AlarmHandler _ANSI_ARGS_(());
+static void AlarmHandler _ANSI_ARGS_((int signum));
/*
*----------------------------------------------------------------------
@@ -671,7 +671,8 @@ TestalarmCmd(clientData, interp, argc, argv)
*/
static void
-AlarmHandler()
+AlarmHandler(signum)
+ int signum;
{
gotsig = "1";
}
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 3de2319..56745b0 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -126,9 +126,9 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags)
if (pthread_create((pthread_t *)idPtr, &attr,
- (void * (*)())proc, (void *)clientData) &&
+ (void * (*)(void *))proc, (void *)clientData) &&
pthread_create((pthread_t *)idPtr, NULL,
- (void * (*)())proc, (void *)clientData)) {
+ (void * (*)(void *))proc, (void *)clientData)) {
result = TCL_ERROR;
} else {
result = TCL_OK;