This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: patches for Irix binutils 2.18
On Mon, Oct 20, 2008 at 08:27:52PM +0000, Jay wrote:
> ok, I did more diligence on obstack problem.
[snip]
> --- binutils-2.18.orig/include/obstack.h 2005-05-10 03:21:08.000000000 -0700
> +++ binutils-2.18/include/obstack.h 2008-10-20 13:10:57.453125000 -0700
> @@ -123,7 +123,7 @@
> #endif
>
> #ifndef __INT_TO_PTR
> -# define __INT_TO_PTR(P) ((P) + (char *) 0)
> +# define __INT_TO_PTR(P) ((void*) ((P) + (char *) 0))
> #endif
>
> /* We need the type of the resulting object. If __PTRDIFF_TYPE__ is
Oh, I see. The non-gcc version of obstack_finish evaluates to an
__INT_TO_PTR expression which is of type char *. So you do need a
cast somewhere when !__GNUC__, otherwise you get warnings on
obstack_alloc. I think it should go in obstack_finish since
__INT_TO_PTR might be defined elsewhere (there's one in as.h).
Applying to gcc/ and src/.
* obstack.h (obstack_finish <!__GNUC__>): Cast result to void *.
Index: include/obstack.h
===================================================================
RCS file: /cvs/src/src/include/obstack.h,v
retrieving revision 1.7
diff -u -p -r1.7 obstack.h
--- include/obstack.h 10 May 2005 10:21:08 -0000 1.7
+++ include/obstack.h 20 Oct 2008 22:43:45 -0000
@@ -527,7 +527,7 @@ __extension__ \
> (h)->chunk_limit - (char *) (h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
- __INT_TO_PTR ((h)->temp))
+ (void *) __INT_TO_PTR ((h)->temp))
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
--
Alan Modra
Australia Development Lab, IBM