From 91b6eb1140eda6bab324821ee3785e5d0ca155b8 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 2 Jun 2017 11:59:28 +0200 Subject: Add internal facility for dynamic array handling This is intended as a type-safe alternative to obstacks and hand-written realloc constructs. The implementation avoids writing function pointers to the heap. --- malloc/Makefile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'malloc/Makefile') diff --git a/malloc/Makefile b/malloc/Makefile index b7d4c63920..af025cbb24 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -41,17 +41,28 @@ tests-static := \ tests-internal := tst-mallocstate tst-scratch_buffer +# The dynarray framework is only available inside glibc. +tests-internal += \ + tst-dynarray \ + tst-dynarray-fail \ + tst-dynarray-at-fail \ + ifneq (no,$(have-tunables)) tests += tst-malloc-usable-tunables tests-static += tst-malloc-usable-static-tunables endif tests += $(tests-static) -test-srcs = tst-mtrace +test-srcs = tst-mtrace tst-dynarray tst-dynarray-fail routines = malloc morecore mcheck mtrace obstack reallocarray \ scratch_buffer_grow scratch_buffer_grow_preserve \ - scratch_buffer_set_array_size + scratch_buffer_set_array_size \ + dynarray_at_failure \ + dynarray_emplace_enlarge \ + dynarray_finalize \ + dynarray_resize \ + dynarray_resize_clear \ install-lib := libmcheck.a non-lib.a := libmcheck.a @@ -137,6 +148,8 @@ ifeq ($(run-built-tests),yes) ifeq (yes,$(build-shared)) ifneq ($(PERL),no) tests-special += $(objpfx)tst-mtrace.out +tests-special += $(objpfx)tst-dynarray-mem.out +tests-special += $(objpfx)tst-dynarray-fail-mem.out endif endif endif @@ -208,3 +221,13 @@ $(objpfx)tst-interpose-thread: \ $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-static-thread: \ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library) + +tst-dynarray-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray.mtrace +$(objpfx)tst-dynarray-mem.out: $(objpfx)tst-dynarray.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-dynarray.mtrace > $@; \ + $(evaluate-test) + +tst-dynarray-fail-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray-fail.mtrace +$(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-dynarray-fail.mtrace > $@; \ + $(evaluate-test) -- cgit v1.2.3