summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2007-10-02 21:54:05 (GMT)
committerhobbs <hobbs>2007-10-02 21:54:05 (GMT)
commit59e65563264c3248be60d5386869e66413d0f859 (patch)
treee84de1a93bd53a28aedb593e328a0841e9d3c867
parente1a0a36aa605b4676909544d263a0986deb1d1ee (diff)
downloadtcl-59e65563264c3248be60d5386869e66413d0f859.zip
tcl-59e65563264c3248be60d5386869e66413d0f859.tar.gz
tcl-59e65563264c3248be60d5386869e66413d0f859.tar.bz2
* generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29
to make macro more warning-robust in unbraced if code.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tcl.h7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index da520dd..e65f7b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29
+ to make macro more warning-robust in unbraced if code.
+
2007-10-02 Don Porter <dgp@users.sourceforge.net>
* generic/tcl.h: Bump version number to 8.5b1.1 to distinguish
diff --git a/generic/tcl.h b/generic/tcl.h
index fc31543..4914058 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -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: tcl.h,v 1.237 2007/10/02 18:27:29 dgp Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.238 2007/10/02 21:54:06 hobbs Exp $
*/
#ifndef _TCL
@@ -2296,10 +2296,11 @@ EXTERN CONST char *Tcl_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp,
# define Tcl_IncrRefCount(objPtr) \
++(objPtr)->refCount
/*
- * Use empty if ; else to handle use in unbraced outer if/else conditions
+ * Use do/while0 idiom for optimum correctness without compiler warnings
+ * http://c2.com/cgi/wiki?TrivialDoWhileLoop
*/
# define Tcl_DecrRefCount(objPtr) \
- if (--(objPtr)->refCount > 0) ; else TclFreeObj(objPtr)
+ do { if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr); } while(0)
# define Tcl_IsShared(objPtr) \
((objPtr)->refCount > 1)
#endif