From e66cb0c31e8286e752f0ce8d20b886af8b8d4507 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 9 Feb 2019 21:05:49 +0000 Subject: Convert Tcl_BacktroundError() into a macro, so we can deprecate the stub entry for it. Add -Wpointer-arith warning to CFLAGS --- generic/tcl.decls | 2 +- generic/tclDecls.h | 7 +++++-- generic/tclEvent.c | 3 +++ generic/tclStubInit.c | 1 + generic/tclTest.c | 4 ++-- win/configure | 2 +- win/tcl.m4 | 2 +- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 367372d..5b3afeb 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -283,7 +283,7 @@ declare 74 { declare 75 { int Tcl_AsyncReady(void) } -declare 76 { +declare 76 {deprecated {No longer in use, changed to macro}} { void Tcl_BackgroundError(Tcl_Interp *interp) } declare 77 {deprecated {Use Tcl_UtfBackslash}} { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d323b73..865c960 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -271,7 +271,8 @@ EXTERN void Tcl_AsyncMark(Tcl_AsyncHandler async); /* 75 */ EXTERN int Tcl_AsyncReady(void); /* 76 */ -EXTERN void Tcl_BackgroundError(Tcl_Interp *interp); +TCL_DEPRECATED("No longer in use, changed to macro") +void Tcl_BackgroundError(Tcl_Interp *interp); /* 77 */ TCL_DEPRECATED("Use Tcl_UtfBackslash") char Tcl_Backslash(const char *src, int *readPtr); @@ -1998,7 +1999,7 @@ typedef struct TclStubs { int (*tcl_AsyncInvoke) (Tcl_Interp *interp, int code); /* 73 */ void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */ int (*tcl_AsyncReady) (void); /* 75 */ - void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */ + TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */ TCL_DEPRECATED_API("Use Tcl_UtfBackslash") char (*tcl_Backslash) (const char *src, int *readPtr); /* 77 */ int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */ void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */ @@ -4070,6 +4071,8 @@ extern const TclStubs *tclStubsPtr; #define Tcl_SetLongObj(objPtr, value) Tcl_SetWideIntObj((objPtr), (long)(value)) #undef Tcl_GetUnicode #define Tcl_GetUnicode(objPtr) Tcl_GetUnicodeFromObj((objPtr), NULL) +#undef Tcl_BackgroundError +#define Tcl_BackgroundError(interp) Tcl_BackgroundException((interp), TCL_ERROR) /* * Deprecated Tcl procedures: diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 913ff0f..7ce5ddd 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -139,6 +139,8 @@ static void FinalizeThread(int quick); *---------------------------------------------------------------------- */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 +#undef Tcl_BackgroundError void Tcl_BackgroundError( Tcl_Interp *interp) /* Interpreter in which an error has @@ -146,6 +148,7 @@ Tcl_BackgroundError( { Tcl_BackgroundException(interp, TCL_ERROR); } +#endif /* TCL_NO_DEPRECATED */ void Tcl_BackgroundException( diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index fa3f734..8429a2f 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -100,6 +100,7 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define Tcl_NewIntObj 0 # define Tcl_NewLongObj 0 # define Tcl_DbNewLongObj 0 +# define Tcl_BackgroundError 0 #else #define TclSetStartupScriptPath setStartupScriptPath diff --git a/generic/tclTest.c b/generic/tclTest.c index 3ebd91d..c87bb54 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -2280,14 +2280,14 @@ TesteventProc( if (result != TCL_OK) { Tcl_AddErrorInfo(interp, " (command bound to \"testevent\" callback)"); - Tcl_BackgroundError(interp); + Tcl_BackgroundException(interp, TCL_ERROR); return 1; /* Avoid looping on errors */ } if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp), &retval) != TCL_OK) { Tcl_AddErrorInfo(interp, " (return value from \"testevent\" callback)"); - Tcl_BackgroundError(interp); + Tcl_BackgroundException(interp, TCL_ERROR); return 1; } if (retval) { diff --git a/win/configure b/win/configure index 0181902..982f96a 100755 --- a/win/configure +++ b/win/configure @@ -4152,7 +4152,7 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= diff --git a/win/tcl.m4 b/win/tcl.m4 index 19897c7..c0dd539 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -685,7 +685,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= -- cgit v0.12