summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordas <das>2006-11-13 08:23:06 (GMT)
committerdas <das>2006-11-13 08:23:06 (GMT)
commit14658604dc06848987405fc50bd939df33cd8796 (patch)
tree99d99df3c8e5314426464d9cf33cc3f090935734 /generic/tclInt.h
parent28b521aa54b70b09061301be5da23d1b4bf33f8e (diff)
downloadtcl-14658604dc06848987405fc50bd939df33cd8796.zip
tcl-14658604dc06848987405fc50bd939df33cd8796.tar.gz
tcl-14658604dc06848987405fc50bd939df33cd8796.tar.bz2
* generic/tclCompExpr.c: fix gcc warnings about 'cast to/from
* generic/tclEncoding.c: pointer from/to integer of different * generic/tclEvent.c: size' on 64-bit platforms by casting to * generic/tclExecute.c: intermediate types intptr_t/uintptr_t * generic/tclHash.c: via new PTR2INT(), INT2PTR(), * generic/tclIO.c: PTR2UINT() and UINT2PTR() macros. * generic/tclInt.h: [Patch 1592791] * generic/tclProc.c: * generic/tclTest.c: * generic/tclThreadStorage.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/configure.in: * unix/tclUnixChan.c: * unix/tclUnixPipe.c: * unix/tclUnixPort.h: * unix/tclUnixTest.c: * unix/tclUnixThrd.c: * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 67be30e..915d2fa 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,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.h,v 1.294 2006/11/12 23:15:41 dkf Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.295 2006/11/13 08:23:08 das Exp $
*/
#ifndef _TCLINT
@@ -113,6 +113,31 @@ typedef int ptrdiff_t;
#endif
/*
+ * Macros used to cast between pointers and integers (e.g. when storing an int
+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
+ * to/from pointer from/to integer of different size".
+ */
+
+#if !defined(INT2PTR) && !defined(PTR2INT)
+# if defined(HAVE_INTPTR_T) || defined(intptr_t)
+# define INT2PTR(p) ((void*)(intptr_t)(p))
+# define PTR2INT(p) ((int)(intptr_t)(p))
+# else
+# define INT2PTR(p) ((void*)(p))
+# define PTR2INT(p) ((int)(p))
+# endif
+#endif
+#if !defined(UINT2PTR) && !defined(PTR2UINT)
+# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
+# define UINT2PTR(p) ((void*)(uintptr_t)(p))
+# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
+# else
+# define UINT2PTR(p) ((void*)(p))
+# define PTR2UINT(p) ((unsigned int)(p))
+# endif
+#endif
+
+/*
* The following procedures allow namespaces to be customized to support
* special name resolution rules for commands/variables.
*/