From: SourceForge.net <no...@so...> - 2006-11-13 09:16:49
|
Patches item #1592791, was opened at 2006-11-09 04:25 Message generated for change (Settings changed) made by das You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310894&aid=1592791&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 52. Configure and Build Tools Group: None Status: Closed Resolution: Fixed Priority: 6 Private: No Submitted By: Daniel A. Steffen (das) >Assigned to: Daniel A. Steffen (das) Summary: Fix 64bit pointer cast warnings Initial Comment: Building 64bit tcl on LP64 platforms with gcc4 (and probably earlier) gives many 'cast to/from pointer from/to integer of different size' warnings about (safe) casts to/from ClientData and other void* types The recommended way to avoid these warnings is to add casts to the intermediate types intptr_t/uintptr_t. The recently released autoconf 2.60 has AC_TYPE_INTPTR_T resp AC_TYPE_UINTPTR_T macros to check if these C99 types are available (if an upgrade to autoconf 2.60 is not possible, it should be possible to write equivalent macros for tcl.m4). The attached patch adds casts to (INTPTR_T) resp (UINTPTR_T) where needed, those are macros in tclInt.h that fall back to void* if the intptr_t / uintptr_t types are not available. I have not touched the windows configure.in, 64bit win will thus fallback as above and may still have those warnings, if so it is probably sufficient to make the same changes as in unix/configure.in but I cannot test this. ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-13 20:05 Message: Logged In: YES user_id=90580 verified that HEAD with this patch builds on all the available SF compilefarm hosts, i.e. alpha-linux1 amd64-linux1 openpower-linux1 sparc-solaris1 x86-freebsd1 x86-linux1 x86-linux2 x86-netbsd1 x86- openbsd1 x86-solaris1 as well as on macosx 10.4 (ppc, ppc64, i386 & x86_64), on macosx 10.3 (ppc) and macosx 10.2 (ppc) ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-13 19:23 Message: Logged In: YES user_id=90580 committed to HEAD ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-10 15:16 Message: Logged In: YES user_id=90580 attached revised patch that no longer depends on autoconf 2.60, instead it implements checks for intptr_t/uintptr_t explicitly in configure.in. like the previous patch, uses PTR2INT(), INT2PTR(), PTR2UINT(), UINT2PTR() macros. if there are no further objections, I'll commit this tomorrow ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-10 00:23 Message: Logged In: YES user_id=90580 come on... $ curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz $ tar zxf autoconf-2.60.tar.gz $ cd autoconf-2.60 $ ./configure --prefix=$HOME/ac --program-suffix=-2.60 $ make install $ ~/ac/bin/autoconf-2.60 --version ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2006-11-10 00:14 Message: Logged In: YES user_id=79902 "it's a matter of 5 minutes to install a new version of autoconf, and it's trivial to have several versions installed" Umm, not round here. Different local policies (and I don't want to do local admin when there are others to do that for me; why keep a dog and bark yourself?) ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-09 23:37 Message: Logged In: YES user_id=90580 attached updated patch that uses PTR2INT(), INT2PTR(), PTR2UINT(), UINT2PTR() as proposed earlier. ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-09 23:04 Message: Logged In: YES user_id=90580 Donal: it's a matter of 5 minutes to install a new version of autoconf, and it's trivial to have several versions installed in parallel (I have 2.13, 2.52, 2.57, 2.59 and 2.60 here...), so I don't think that's a valid objection. In any case, returning to 2.13 is certainly not an option, it is broken in so many ways, and we use numerous ac 2.5x- only features in HEAD configure.in & tcl.m4 now; moreover, parity of HEAD's tcl.m4 with tclconfig/tcl.m4 needs to be maintained (i.e. all TEA3 extension would have to go back to 2.13, which isn't going to happen). Jan: I'm don't think size_t would work, it is defined to be the type returned by sizeof, which does not need to be the same size as that of a pointer (admittedly this would only happen on exotic platforms...) Also, in C89 there is no standard signed equivalent of size_t, and in pre-C89, size_t is not even guaranteed to be an unsigned type... ---------------------------------------------------------------------- Comment By: Jan Nijtmans (nijtmans) Date: 2006-11-09 22:26 Message: Logged In: YES user_id=61031 Suggestion: why not use an intermediate cast to size_t. This is a type that exists in C89 as well, and it works the same. No change to autoconf is needed. Regards, Jan Nijtmans ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2006-11-09 22:13 Message: Logged In: YES user_id=79902 Please, no autoconf version changes. Or, if they have to change, we should go back to using autoconf 2.13 (since that produced much faster configure scripts) or 2.57 (which is the version I have. :-)) ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-09 05:49 Message: Logged In: YES user_id=90580 while intptr_t/uintptr_t are C99isms, gcc makes them available in C89 mode as well; in any case, ac checks if they are available in <inttypes.h> or <stdint.h>, otherwise it finds a scalar type of the same size as s a pointer and defines intptr_t/uintptr_t to that. If this fails (and on win currently), my INTPTR_T/UINTPTR_T macros fall back to do a nop cast to (void*). I agree about the ugliness, while standard, INTPTR_T is not a very nice name, but I couldn't come up with anything memnonic to designate a cast to an integer type defined to be the same size as a pointer... I think UINT() would be confusing if you mean it to be just a cast to (intptr_t), but it might make sense for a cast of a pointer to (int)(intptr_t). We would then also need a name for the other direction, i.e. cast of an int to (void*)(intptr_t), as well as (unsigned int) variants of both, e.g. UINT(), UPTR(), UUINT(), UUPTR() ? not sure that's all that clear, maybe PTR2INT(), INT2PTR, PTR2UINT, UINT2PTR() ? ---------------------------------------------------------------------- Comment By: Jeffrey Hobbs (hobbs) Date: 2006-11-09 05:01 Message: Logged In: YES user_id=72656 Tcl is still stuck in pre-C89 code compatibility. I believe the head should be able to move to C89, but /not/ C99, so lets keep that in mind for whatever changes are required. As far as the patching goes, I'd like to minimize the ugliness of these casts, and preferably give them some form that is clear in use, like the UCHAR() macro (something like UINT()). Otherwise I guess I'm ok with requiring ac 2.60 on the head, although I'll have to upgrade myself (only 2.59 on all my machines). ---------------------------------------------------------------------- Comment By: Daniel A. Steffen (das) Date: 2006-11-09 04:42 Message: Logged In: YES user_id=90580 Jeff, any objections to the autoconf 2.60 upgrade ? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=310894&aid=1592791&group_id=10894 |