summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
authordas <das@noemail.net>2005-12-15 04:08:32 (GMT)
committerdas <das@noemail.net>2005-12-15 04:08:32 (GMT)
commit5e511ef5aab7d18173ff056e448b8f7093cb8a51 (patch)
tree779564ea699a57f98f4e71c4071574b343eb2f1c /generic/tclIOUtil.c
parentc7dbd21a088915ed1f461ee437c44ef8e8cb205f (diff)
downloadtcl-5e511ef5aab7d18173ff056e448b8f7093cb8a51.zip
tcl-5e511ef5aab7d18173ff056e448b8f7093cb8a51.tar.gz
tcl-5e511ef5aab7d18173ff056e448b8f7093cb8a51.tar.bz2
* generic/tclIOUtil.c: workaround gcc warning "comparison is always
* generic/tclTest.c: false due to limited range of data type". FossilOrigin-Name: 1e9a2ab78a10f7d75a028a8fd8b43dcf80d82553
Diffstat (limited to 'generic/tclIOUtil.c')
-rw-r--r--generic/tclIOUtil.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 92203cc..c60cd8e 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.126 2005/11/27 02:33:49 das Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.127 2005/12/15 04:08:33 das Exp $
*/
#include "tclInt.h"
@@ -76,8 +76,19 @@ Tcl_Stat(
# 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.