summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-12-16 23:25:59 (GMT)
committernijtmans <nijtmans>2009-12-16 23:25:59 (GMT)
commitc09d5284e91311929d7e92c73492076e8a05cd36 (patch)
treeb7038bbc46d46d90860a433594776df4f31d744e /generic
parentcf4896697457a54ad804eebeb31b63e27e41cb6c (diff)
downloadtcl-c09d5284e91311929d7e92c73492076e8a05cd36.zip
tcl-c09d5284e91311929d7e92c73492076e8a05cd36.tar.gz
tcl-c09d5284e91311929d7e92c73492076e8a05cd36.tar.bz2
Fix gcc warning: ignoring return value of ‘write’,
declared with attribute warn_unused_result CONSTify functions TclpGetUserHome and TclSetPreInitScript (TIP #27)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.decls6
-rw-r--r--generic/tclIntDecls.h10
-rw-r--r--generic/tclInterp.c10
-rw-r--r--generic/tclTest.c14
4 files changed, 24 insertions, 16 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index dc4a7ff..2d0e460 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tclInt.decls,v 1.140 2009/07/15 13:17:18 dkf Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.141 2009/12/16 23:26:01 nijtmans Exp $
library tcl
@@ -186,7 +186,7 @@ declare 41 generic {
Tcl_Command TclGetOriginalCommand(Tcl_Command command)
}
declare 42 generic {
- char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr)
+ CONST86 char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr)
}
# Removed in Tcl 8.5a2
#declare 43 generic {
@@ -412,7 +412,7 @@ declare 98 generic {
# Tcl_Obj *objPtr, int flags)
#}
declare 101 generic {
- char *TclSetPreInitScript(char *string)
+ CONST86 char *TclSetPreInitScript(const char *string)
}
declare 102 generic {
void TclSetupEnv(Tcl_Interp *interp)
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 5672e25..a01b938 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIntDecls.h,v 1.134 2009/07/15 13:17:18 dkf Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.135 2009/12/16 23:26:00 nijtmans Exp $
*/
#ifndef _TCLINTDECLS
@@ -208,7 +208,7 @@ EXTERN Tcl_Command TclGetOriginalCommand (Tcl_Command command);
#ifndef TclpGetUserHome_TCL_DECLARED
#define TclpGetUserHome_TCL_DECLARED
/* 42 */
-EXTERN char * TclpGetUserHome (const char * name,
+EXTERN CONST86 char * TclpGetUserHome (const char * name,
Tcl_DString * bufferPtr);
#endif
/* Slot 43 is reserved */
@@ -408,7 +408,7 @@ EXTERN int TclServiceIdle (void);
#ifndef TclSetPreInitScript_TCL_DECLARED
#define TclSetPreInitScript_TCL_DECLARED
/* 101 */
-EXTERN char * TclSetPreInitScript (char * string);
+EXTERN CONST86 char * TclSetPreInitScript (const char * string);
#endif
#ifndef TclSetupEnv_TCL_DECLARED
#define TclSetupEnv_TCL_DECLARED
@@ -1100,7 +1100,7 @@ typedef struct TclIntStubs {
TclObjCmdProcType (*tclGetObjInterpProc) (void); /* 39 */
int (*tclGetOpenMode) (Tcl_Interp * interp, const char * str, int * seekFlagPtr); /* 40 */
Tcl_Command (*tclGetOriginalCommand) (Tcl_Command command); /* 41 */
- char * (*tclpGetUserHome) (const char * name, Tcl_DString * bufferPtr); /* 42 */
+ CONST86 char * (*tclpGetUserHome) (const char * name, Tcl_DString * bufferPtr); /* 42 */
void *reserved43;
int (*tclGuessPackageName) (const char * fileName, Tcl_DString * bufPtr); /* 44 */
int (*tclHideUnsafeCommands) (Tcl_Interp * interp); /* 45 */
@@ -1159,7 +1159,7 @@ typedef struct TclIntStubs {
int (*tclServiceIdle) (void); /* 98 */
void *reserved99;
void *reserved100;
- char * (*tclSetPreInitScript) (char * string); /* 101 */
+ CONST86 char * (*tclSetPreInitScript) (const char * string); /* 101 */
void (*tclSetupEnv) (Tcl_Interp * interp); /* 102 */
int (*tclSockGetPort) (Tcl_Interp * interp, const char * str, const char * proto, int * portPtr); /* 103 */
int (*tclSockMinimumBuffers) (int sock, int size); /* 104 */
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index edf31ff..89b635d 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.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: tclInterp.c,v 1.107 2009/12/05 21:30:05 msofer Exp $
+ * RCS: @(#) $Id: tclInterp.c,v 1.108 2009/12/16 23:26:01 nijtmans Exp $
*/
#include "tclInt.h"
@@ -21,7 +21,7 @@
* above. This variable can be modified by the function below.
*/
-static char *tclPreInitScript = NULL;
+static const char *tclPreInitScript = NULL;
/* Forward declaration */
struct Target;
@@ -265,11 +265,11 @@ static void TimeLimitCallback(ClientData clientData);
*----------------------------------------------------------------------
*/
-char *
+const char *
TclSetPreInitScript(
- char *string) /* Pointer to a script. */
+ const char *string) /* Pointer to a script. */
{
- char *prevString = tclPreInitScript;
+ const char *prevString = tclPreInitScript;
tclPreInitScript = string;
return(prevString);
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 812a610..192e7e2 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.142 2009/12/12 19:57:26 dkf Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.143 2009/12/16 23:26:01 nijtmans Exp $
*/
#undef STATIC_BUILD
@@ -2222,9 +2222,13 @@ ExitProcOdd(
ClientData clientData) /* Integer value to print. */
{
char buf[16 + TCL_INTEGER_SPACE];
+ size_t len;
sprintf(buf, "odd %d\n", PTR2INT(clientData));
- (void)write(1, buf, strlen(buf));
+ len = strlen(buf);
+ if (len != (size_t) write(1, buf, len)) {
+ Tcl_Panic("ExitProcOdd: unable to write to stdout");
+ }
}
static void
@@ -2232,9 +2236,13 @@ ExitProcEven(
ClientData clientData) /* Integer value to print. */
{
char buf[16 + TCL_INTEGER_SPACE];
+ size_t len;
sprintf(buf, "even %d\n", PTR2INT(clientData));
- (void)write(1, buf, strlen(buf));
+ len = strlen(buf);
+ if (len != (size_t) write(1, buf, len)) {
+ Tcl_Panic("ExitProcEven: unable to write to stdout");
+ }
}
/*