summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordas <das>2005-12-15 04:08:26 (GMT)
committerdas <das>2005-12-15 04:08:26 (GMT)
commit2be26782295e8963ba3080532c2ed3bd9aabb7e8 (patch)
tree72c167d3c6e9a20e08a71bdbc50e57d9a128d2aa /generic
parent395a015365e40d2f826658b1216096a6f110f064 (diff)
downloadtcl-2be26782295e8963ba3080532c2ed3bd9aabb7e8.zip
tcl-2be26782295e8963ba3080532c2ed3bd9aabb7e8.tar.gz
tcl-2be26782295e8963ba3080532c2ed3bd9aabb7e8.tar.bz2
* generic/tclIOUtil.c: workaround gcc warning "comparison is always
* generic/tclTest.c: false due to limited range of data type".
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOUtil.c13
-rw-r--r--generic/tclTest.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 73f824d..638355c 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.23 2005/11/27 02:34:41 das Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.24 2005/12/15 04:08:26 das Exp $
*/
#include "tclInt.h"
@@ -144,8 +144,19 @@ Tcl_Stat(path, oldStyleBuf)
# define OUT_OF_RANGE(x) \
(((Tcl_WideInt)(x)) < Tcl_LongAsWide(LONG_MIN) || \
((Tcl_WideInt)(x)) > Tcl_LongAsWide(LONG_MAX))
+#if defined(__GNUC__) && __GNUC__ >= 2
+/*
+ * Workaround gcc warning of "comparison is always false due to limited range of
+ * data type" in this macro by checking max type size, and when necessary ANDing
+ * with the complement of ULONG_MAX instead of the comparison:
+ */
+# define OUT_OF_URANGE(x) \
+ ((((Tcl_WideUInt)(~ (__typeof__(x)) 0)) > (Tcl_WideUInt)ULONG_MAX) && \
+ (((Tcl_WideUInt)(x)) & ~(Tcl_WideUInt)ULONG_MAX))
+#else
# define OUT_OF_URANGE(x) \
(((Tcl_WideUInt)(x)) > (Tcl_WideUInt)ULONG_MAX)
+#endif
/*
* Perform the result-buffer overflow check manually.
diff --git a/generic/tclTest.c b/generic/tclTest.c
index e02ba13..59c3148 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.62.2.10 2005/10/23 22:01:30 msofer Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.62.2.11 2005/12/15 04:08:26 das Exp $
*/
#define TCL_TEST
@@ -4715,8 +4715,19 @@ static int PretendTclpStat(path, buf)
# define OUT_OF_RANGE(x) \
(((Tcl_WideInt)(x)) < Tcl_LongAsWide(LONG_MIN) || \
((Tcl_WideInt)(x)) > Tcl_LongAsWide(LONG_MAX))
+#if defined(__GNUC__) && __GNUC__ >= 2
+/*
+ * Workaround gcc warning of "comparison is always false due to limited range of
+ * data type" in this macro by checking max type size, and when necessary ANDing
+ * with the complement of ULONG_MAX instead of the comparison:
+ */
+# define OUT_OF_URANGE(x) \
+ ((((Tcl_WideUInt)(~ (__typeof__(x)) 0)) > (Tcl_WideUInt)ULONG_MAX) && \
+ (((Tcl_WideUInt)(x)) & ~(Tcl_WideUInt)ULONG_MAX))
+#else
# define OUT_OF_URANGE(x) \
(((Tcl_WideUInt)(x)) > (Tcl_WideUInt)ULONG_MAX)
+#endif
/*
* Perform the result-buffer overflow check manually.