This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
Re: [PATCH] libgui: Make it compileable on windows with recent gcc versions and also on win64
- From: Roland Schwingel <roland at onevision dot com>
- To: insight at sourceware dot org, Keith Seitz <keiths at redhat dot com>
- Date: Wed, 08 Aug 2012 15:36:43 +0200
- Subject: Re: [PATCH] libgui: Make it compileable on windows with recent gcc versions and also on win64
Hi,
Finally I found some air to commit this...
Keith Seitz <keiths@redhat.com> wrote on 04.06.2012 03:13:15:
> Thanks for the patch. I only have a (very) minor few nits...
I addressed all of your notes beside of 2 (see below).
> > @@ -631,6 +638,31 @@
> > (rowPtr), (colPtr))
> >
> > /*
> > + * 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
>
> I'm not going to force this file to the GNU Coding Standard.
> Just please be consistent with the surrounding code. For example,
> "!defined(INT2PTR) && !defined(PTR2INT)" seems more natural.
I left this on purpose as the above construct was directly taken
from tcl itself and I would like to see this to be in sync for
better overview. The definition is done if you compile against
older tcl which has some of these definitions not in place.
> > diff -ruN libgui_orig/src/tkWinPrintText.c libgui/src/tkWinPrintText.c
> > --- libgui_orig/src/tkWinPrintText.c 2001-09-09
00:34:48.000000000 +0200
> > +++ libgui/src/tkWinPrintText.c 2012-03-22 13:56:42.037502500 +0100
> > +#if (TCL_MAJOR_VERSION>= 8)&& (TCL_MINOR_VERSION>= 5)
> > + numLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree,textPtr);
> > + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
0,0,&first);
> > + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
> numLines, 100,&last);
> > + TkTextChanged(textPtr->sharedTextPtr, textPtr,&first,&last);
> > +#elif (TCL_MAJOR_VERSION>= 8)&& (TCL_MINOR_VERSION>= 1)
> > numLines = TkBTreeNumLines(textPtr->tree);
> > -#if (TCL_MAJOR_VERSION>= 8)&& (TCL_MINOR_VERSION>= 1)
> > TkTextMakeByteIndex(textPtr->tree, 0, 0,&first);
> > TkTextMakeByteIndex(textPtr->tree, numLines, 100,&last);
> > + TkTextChanged(textPtr,&first,&last);
> > #else
> > + numLines = TkBTreeNumLines(textPtr->tree);
> > TkTextMakeIndex(textPtr->tree, 0, 0,&first);
> > TkTextMakeIndex(textPtr->tree, numLines, 100,&last);
> > -#endif
> > TkTextChanged(textPtr,&first,&last);
> > -
> > +#endif
> > /*
> > * Set the display info flag to out-of-date.
> > */
>
> I'd like to see spaces before/after "&&", "||", ">", "<", ">=", etc.
> This happens in a few places.
This might have been an issue of your editor in my patch it appeared
to be correct. (????)
As already outlined some time ago this patch is just a first starting
point in cleaning up libgui to ensure compileability with newer tcl/tk
versions and current mingw/mingw-w64 compilers.
Roland