Blame SOURCES/gcc32-obstack-lvalues.patch

6f1b0c
2003-10-22  Joseph S. Myers  <jsm@polyomino.org.uk>
6f1b0c
6f1b0c
	* obstack.h: Merge the following change from gnulib:
6f1b0c
	2003-10-21  Paul Eggert  <eggert@twinsun.com>
6f1b0c
	* obstack.h (obstack_1grow_fast): Properly parenthesize arg.
6f1b0c
	(obstack_ptr_grow_fast, obstack_int_grow_fast):
6f1b0c
	Don't use lvalue casts, as GCC plans to remove support for them
6f1b0c
	in GCC 3.5.  Reported by Joseph S. Myers.  This bug
6f1b0c
	was also present in the non-GCC version, indicating that this
6f1b0c
	code had always been buggy and had never been widely used.
6f1b0c
	(obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank):
6f1b0c
	Use the fast variant of each macro, rather than copying the
6f1b0c
	definiens of the fast variant; that way, we'll be more likely to
6f1b0c
	catch future bugs in the fast variants.
6f1b0c
6f1b0c
--- include/obstack.h	14 Mar 2001 19:44:38 -0000	1.5
6f1b0c
+++ include/obstack.h	22 Oct 2003 22:28:20 -0000	1.6
6f1b0c
@@ -343,7 +343,7 @@ extern int obstack_exit_failure;
6f1b0c
 
6f1b0c
 #endif
6f1b0c
 
6f1b0c
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
6f1b0c
+#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
6f1b0c
 
6f1b0c
 #define obstack_blank_fast(h,n) ((h)->next_free += (n))
6f1b0c
 
6f1b0c
@@ -411,7 +411,7 @@ __extension__								\
6f1b0c
 ({ struct obstack *__o = (OBSTACK);					\
6f1b0c
    if (__o->next_free + 1 > __o->chunk_limit)				\
6f1b0c
      _obstack_newchunk (__o, 1);					\
6f1b0c
-   *(__o->next_free)++ = (datum);					\
6f1b0c
+   obstack_1grow_fast (__o, datum);					\
6f1b0c
    (void) 0; })
6f1b0c
 
6f1b0c
 /* These assume that the obstack alignment is good enough for pointers or ints,
6f1b0c
@@ -423,19 +423,28 @@ __extension__								\
6f1b0c
 ({ struct obstack *__o = (OBSTACK);					\
6f1b0c
    if (__o->next_free + sizeof (void *) > __o->chunk_limit)		\
6f1b0c
      _obstack_newchunk (__o, sizeof (void *));				\
6f1b0c
-   *((void **)__o->next_free)++ = ((void *)datum);			\
6f1b0c
-   (void) 0; })
6f1b0c
+   obstack_ptr_grow_fast (__o, datum); })
6f1b0c
 
6f1b0c
 # define obstack_int_grow(OBSTACK,datum)				\
6f1b0c
 __extension__								\
6f1b0c
 ({ struct obstack *__o = (OBSTACK);					\
6f1b0c
    if (__o->next_free + sizeof (int) > __o->chunk_limit)		\
6f1b0c
      _obstack_newchunk (__o, sizeof (int));				\
6f1b0c
-   *((int *)__o->next_free)++ = ((int)datum);				\
6f1b0c
+   obstack_int_grow_fast (__o, datum); })
6f1b0c
+
6f1b0c
+# define obstack_ptr_grow_fast(OBSTACK,aptr)				\
6f1b0c
+__extension__								\
6f1b0c
+({ struct obstack *__o1 = (OBSTACK);					\
6f1b0c
+   *(const void **) __o1->next_free = (aptr);				\
6f1b0c
+   __o1->next_free += sizeof (const void *);				\
6f1b0c
    (void) 0; })
6f1b0c
 
6f1b0c
-# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr)
6f1b0c
-# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
6f1b0c
+# define obstack_int_grow_fast(OBSTACK,aint)				\
6f1b0c
+__extension__								\
6f1b0c
+({ struct obstack *__o1 = (OBSTACK);					\
6f1b0c
+   *(int *) __o1->next_free = (aint);					\
6f1b0c
+   __o1->next_free += sizeof (int);					\
6f1b0c
+   (void) 0; })
6f1b0c
 
6f1b0c
 # define obstack_blank(OBSTACK,length)					\
6f1b0c
 __extension__								\
6f1b0c
@@ -443,7 +452,7 @@ __extension__								\
6f1b0c
    int __len = (length);						\
6f1b0c
    if (__o->chunk_limit - __o->next_free < __len)			\
6f1b0c
      _obstack_newchunk (__o, __len);					\
6f1b0c
-   __o->next_free += __len;						\
6f1b0c
+   obstack_blank_fast (__o, __len);					\
6f1b0c
    (void) 0; })
6f1b0c
 
6f1b0c
 # define obstack_alloc(OBSTACK,length)					\
6f1b0c
@@ -530,26 +539,29 @@ __extension__								\
6f1b0c
 # define obstack_1grow(h,datum)						\
6f1b0c
 ( (((h)->next_free + 1 > (h)->chunk_limit)				\
6f1b0c
    ? (_obstack_newchunk ((h), 1), 0) : 0),				\
6f1b0c
-  (*((h)->next_free)++ = (datum)))
6f1b0c
+  obstack_1grow_fast (h, datum))
6f1b0c
 
6f1b0c
 # define obstack_ptr_grow(h,datum)					\
6f1b0c
 ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)		\
6f1b0c
    ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),		\
6f1b0c
-  (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum)))
6f1b0c
+  obstack_ptr_grow_fast (h, datum))
6f1b0c
 
6f1b0c
 # define obstack_int_grow(h,datum)					\
6f1b0c
 ( (((h)->next_free + sizeof (int) > (h)->chunk_limit)			\
6f1b0c
    ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),			\
6f1b0c
-  (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum)))
6f1b0c
+  obstack_int_grow_fast (h, datum))
6f1b0c
+
6f1b0c
+# define obstack_ptr_grow_fast(h,aptr)					\
6f1b0c
+  (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
6f1b0c
 
6f1b0c
-# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr)
6f1b0c
-# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
6f1b0c
+# define obstack_int_grow_fast(h,aint)					\
6f1b0c
+  (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
6f1b0c
 
6f1b0c
 # define obstack_blank(h,length)					\
6f1b0c
 ( (h)->temp = (length),							\
6f1b0c
   (((h)->chunk_limit - (h)->next_free < (h)->temp)			\
6f1b0c
    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),			\
6f1b0c
-  ((h)->next_free += (h)->temp))
6f1b0c
+  obstack_blank_fast (h, (h)->temp))
6f1b0c
 
6f1b0c
 # define obstack_alloc(h,length)					\
6f1b0c
  (obstack_blank ((h), (length)), obstack_finish ((h)))