diff mbox

[0/5] obstacks

Message ID 1406354233-7664-1-git-send-email-amodra@gmail.com
State New
Headers show

Commit Message

Alan Modra July 26, 2014, 5:57 a.m. UTC
This patch series gives obstacks some much needed TLC.  The first patch
is mostly just a tidy, with one perhaps controversial change, renaming
the function obstack_free to _obstack_free.  This will be visible to
users who compile some code using a new obstack.h and try to link
against an old (but not ancient!) relocatable obstack.o.  They will
need to recompile their obstack.o.  Users linking against glibc won't
see a problem since glibc exports both _obstack_free and obstack_free.
I figure the number of people affected by this rename is small, and
note that gnulib made a change that would similarly affect linking
against relocatable object files when _obstack_free was removed..

The second and third patch get us to the point where 4G obstacks are
supported without significantly changing the ABI.  At this point some
code will need fixes, due to people wrongly using obstack internals.
For instance, gcc needs some changes like the following (which is
backward compatible with current libiberty obstacks):


gcc needs other fixes for existing upstream obstack changes,
obstack_base() now returns a void* where it previously returned a char*.

The fourth patch switches obstacks to use size_t for sizes, and
contains the necessary machinery for glibc to compile obstacks twice,
once for version 1 compatibiliy, and once for version 2.

The fifth patch avoids the necessity to install other gnulib headers
in libiberty, and importantly, avoids the need for a whole lot of
gnulib configury.  Running configure already takes signigicant time in
libiberty.  I don't want to double that time.

Alan Modra (5):
  obstack tidy
  64-bit obstack support, part 1
  64-bit obstack support, part 2
  64-bit obstack support, part 3
  obstack usability

 lib/obstack.c   |  275 ++++++++++++++++++++++++-------------------------------
 lib/obstack.h   |  244 ++++++++++++++++++++++++++++++------------------
 modules/obstack |    1 +
 3 files changed, 273 insertions(+), 247 deletions(-)
diff mbox

Patch

Index: gcc/coretypes.h
===================================================================
--- gcc/coretypes.h	(revision 212477)
+++ gcc/coretypes.h	(working copy)
@@ -158,13 +158,13 @@  struct basic_block_def;
 typedef struct basic_block_def *basic_block;
 typedef const struct basic_block_def *const_basic_block;
 
-#define obstack_chunk_alloc	((void *(*) (long)) xmalloc)
-#define obstack_chunk_free	((void (*) (void *)) free)
+#define obstack_chunk_alloc	xmalloc
+#define obstack_chunk_free	free
 #define OBSTACK_CHUNK_SIZE	0
-#define gcc_obstack_init(OBSTACK)			\
-  _obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0,	\
-		  obstack_chunk_alloc,			\
-		  obstack_chunk_free)
+#define gcc_obstack_init(OBSTACK)				\
+  obstack_specify_allocation ((OBSTACK), OBSTACK_CHUNK_SIZE, 0,	\
+			      obstack_chunk_alloc,		\
+			      obstack_chunk_free)
 
 /* enum reg_class is target specific, so it should not appear in
    target-independent code or interfaces, like the target hook declarations