aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2017-01-11 15:09:55 -0500
committerDJ Delorie <dj@delorie.com>2017-01-11 15:09:55 -0500
commit4250ac7f60baa1977ea646610e35a2368ce6a56a (patch)
tree8fb3b485156808397678e4c7922ace0a511ee00d /malloc
parentba163b353ee76e9dad24246cb07e47a6840cfbae (diff)
parent6a1cefac196f45d766027c97a6c8c44459c9cccd (diff)
downloadglibc-4250ac7f60baa1977ea646610e35a2368ce6a56a.zip
glibc-4250ac7f60baa1977ea646610e35a2368ce6a56a.tar.gz
glibc-4250ac7f60baa1977ea646610e35a2368ce6a56a.tar.bz2
Merge branch 'master' into dj/malloc-tcache
Diffstat (limited to 'malloc')
-rw-r--r--malloc/Makefile11
-rw-r--r--malloc/arena.c56
-rw-r--r--malloc/hooks.c2
-rw-r--r--malloc/malloc-hooks.h2
-rw-r--r--malloc/malloc-internal.h2
-rw-r--r--malloc/malloc.c2
-rw-r--r--malloc/malloc.h2
-rw-r--r--malloc/mcheck-init.c2
-rw-r--r--malloc/mcheck.c2
-rw-r--r--malloc/mcheck.h2
-rw-r--r--malloc/memusage.c2
-rwxr-xr-xmalloc/memusage.sh4
-rw-r--r--malloc/memusagestat.c4
-rw-r--r--malloc/morecore.c2
-rw-r--r--malloc/mtrace.c2
-rw-r--r--malloc/mtrace.pl4
-rw-r--r--malloc/obstack.c2
-rw-r--r--malloc/obstack.h2
-rw-r--r--malloc/scratch_buffer_grow.c2
-rw-r--r--malloc/scratch_buffer_grow_preserve.c2
-rw-r--r--malloc/scratch_buffer_set_array_size.c2
-rw-r--r--malloc/set-freeres.c2
-rw-r--r--malloc/thread-freeres.c2
-rw-r--r--malloc/tst-calloc.c2
-rw-r--r--malloc/tst-interpose-aux-nothread.c2
-rw-r--r--malloc/tst-interpose-aux-thread.c2
-rw-r--r--malloc/tst-interpose-aux.c2
-rw-r--r--malloc/tst-interpose-aux.h2
-rw-r--r--malloc/tst-interpose-nothread.c2
-rw-r--r--malloc/tst-interpose-skeleton.c2
-rw-r--r--malloc/tst-interpose-static-nothread.c2
-rw-r--r--malloc/tst-interpose-static-thread.c2
-rw-r--r--malloc/tst-interpose-thread.c2
-rw-r--r--malloc/tst-malloc-backtrace.c16
-rw-r--r--malloc/tst-malloc-fork-deadlock.c34
-rw-r--r--malloc/tst-malloc-thread-exit.c123
-rw-r--r--malloc/tst-malloc-thread-fail.c4
-rw-r--r--malloc/tst-malloc-usable-static-tunables.c1
-rw-r--r--malloc/tst-malloc-usable-static.c1
-rw-r--r--malloc/tst-malloc-usable-tunables.c1
-rw-r--r--malloc/tst-malloc-usable.c2
-rw-r--r--malloc/tst-malloc.c17
-rw-r--r--malloc/tst-mallocfork2.c3
-rw-r--r--malloc/tst-mallocstate.c2
-rw-r--r--malloc/tst-mallopt.c2
-rw-r--r--malloc/tst-mcheck.c24
-rw-r--r--malloc/tst-memalign.c2
-rw-r--r--malloc/tst-mtrace.c2
-rwxr-xr-xmalloc/tst-mtrace.sh2
-rw-r--r--malloc/tst-posix_memalign.c2
-rw-r--r--malloc/tst-pvalloc.c2
-rw-r--r--malloc/tst-realloc.c17
-rw-r--r--malloc/tst-scratch_buffer.c2
-rw-r--r--malloc/tst-valloc.c2
54 files changed, 209 insertions, 187 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index 94a9661..dd8a43a 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2016 Free Software Foundation, Inc.
+# Copyright (C) 1991-2017 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,12 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
tests-static := \
tst-interpose-static-nothread \
tst-interpose-static-thread \
+ tst-malloc-usable-static \
+
+ifneq (no,$(have-tunables))
+tests += tst-malloc-usable-tunables
+tests-static += tst-malloc-usable-static-tunables
+endif
tests += $(tests-static)
test-srcs = tst-mtrace
@@ -158,6 +164,9 @@ endif
tst-mcheck-ENV = MALLOC_CHECK_=3
tst-malloc-usable-ENV = MALLOC_CHECK_=3
+tst-malloc-usable-static-ENV = $(tst-malloc-usable-ENV)
+tst-malloc-usable-tunables-ENV = GLIBC_TUNABLES=glibc.malloc.check=3
+tst-malloc-usable-static-tunables-ENV = $(tst-malloc-usable-tunables-ENV)
ifeq ($(experimental-malloc),yes)
CPPFLAGS-malloc.c += -DUSE_TCACHE
diff --git a/malloc/arena.c b/malloc/arena.c
index eed4247..b91d7d6 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -19,6 +19,11 @@
#include <stdbool.h>
+#if HAVE_TUNABLES
+# define TUNABLE_NAMESPACE malloc
+#endif
+#include <elf/dl-tunables.h>
+
/* Compile-time constants. */
#define HEAP_MIN_SIZE (32 * 1024)
@@ -204,6 +209,34 @@ __malloc_fork_unlock_child (void)
__libc_lock_init (list_lock);
}
+#if HAVE_TUNABLES
+static inline int do_set_mallopt_check (int32_t value);
+void
+DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
+{
+ int32_t value = *(int32_t *) valp;
+ do_set_mallopt_check (value);
+ if (check_action != 0)
+ __malloc_check_init ();
+}
+
+# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
+static inline int do_ ## __name (__type value); \
+void \
+DL_TUNABLE_CALLBACK (__name) (void *valp) \
+{ \
+ __type value = *(__type *) valp; \
+ do_ ## __name (value); \
+}
+
+DL_TUNABLE_CALLBACK_FNDECL (set_mmap_threshold, size_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_mmaps_max, int32_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_top_pad, size_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_perturb_byte, int32_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_trim_threshold, size_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_arena_max, size_t)
+DL_TUNABLE_CALLBACK_FNDECL (set_arena_test, size_t)
+#else
/* Initialization routine. */
#include <string.h>
extern char **_environ;
@@ -238,6 +271,7 @@ next_env_entry (char ***position)
return result;
}
+#endif
#ifdef SHARED
@@ -272,6 +306,24 @@ ptmalloc_init (void)
#endif
thread_arena = &main_arena;
+
+#if HAVE_TUNABLES
+ /* Ensure initialization/consolidation and do it under a lock so that a
+ thread attempting to use the arena in parallel waits on us till we
+ finish. */
+ __libc_lock_lock (main_arena.mutex);
+ malloc_consolidate (&main_arena);
+
+ TUNABLE_SET_VAL_WITH_CALLBACK (check, NULL, set_mallopt_check);
+ TUNABLE_SET_VAL_WITH_CALLBACK (top_pad, NULL, set_top_pad);
+ TUNABLE_SET_VAL_WITH_CALLBACK (perturb, NULL, set_perturb_byte);
+ TUNABLE_SET_VAL_WITH_CALLBACK (mmap_threshold, NULL, set_mmap_threshold);
+ TUNABLE_SET_VAL_WITH_CALLBACK (trim_threshold, NULL, set_trim_threshold);
+ TUNABLE_SET_VAL_WITH_CALLBACK (mmap_max, NULL, set_mmaps_max);
+ TUNABLE_SET_VAL_WITH_CALLBACK (arena_max, NULL, set_arena_max);
+ TUNABLE_SET_VAL_WITH_CALLBACK (arena_test, NULL, set_arena_test);
+ __libc_lock_unlock (main_arena.mutex);
+#else
const char *s = NULL;
if (__glibc_likely (_environ != NULL))
{
@@ -340,6 +392,8 @@ ptmalloc_init (void)
if (check_action != 0)
__malloc_check_init ();
}
+#endif
+
#if HAVE_MALLOC_INIT_HOOK
void (*hook) (void) = atomic_forced_read (__malloc_initialize_hook);
if (hook != NULL)
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 12995d3..1d80be2 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
diff --git a/malloc/malloc-hooks.h b/malloc/malloc-hooks.h
index c7aa8b2..6b1d192 100644
--- a/malloc/malloc-hooks.h
+++ b/malloc/malloc-hooks.h
@@ -1,5 +1,5 @@
/* Internal declarations of malloc hooks no longer in the public API.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/malloc-internal.h b/malloc/malloc-internal.h
index a3df8c3..de6103d 100644
--- a/malloc/malloc-internal.h
+++ b/malloc/malloc-internal.h
@@ -1,5 +1,5 @@
/* Internal declarations for malloc, for use within libc.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e57d0cd..1621fb3 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>
and Doug Lea <dl@cs.oswego.edu>, 2001.
diff --git a/malloc/malloc.h b/malloc/malloc.h
index e0c2788..0bd8f97 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -1,5 +1,5 @@
/* Prototypes and definition for malloc implementation.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/mcheck-init.c b/malloc/mcheck-init.c
index 8d63dd3..6d2492e 100644
--- a/malloc/mcheck-init.c
+++ b/malloc/mcheck-init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 73491b1..5128d68 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -1,5 +1,5 @@
/* Standard debugging hooks for `malloc'.
- Copyright (C) 1990-2016 Free Software Foundation, Inc.
+ Copyright (C) 1990-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written May 1989 by Mike Haertel.
diff --git a/malloc/mcheck.h b/malloc/mcheck.h
index 416fcd6..3d56bef 100644
--- a/malloc/mcheck.h
+++ b/malloc/mcheck.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/memusage.c b/malloc/memusage.c
index 3bf0b9d..3deca2a 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -1,5 +1,5 @@
/* Profile heap and stack memory usage of running program.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/malloc/memusage.sh b/malloc/memusage.sh
index 7430f88..93ece87 100755
--- a/malloc/memusage.sh
+++ b/malloc/memusage.sh
@@ -1,5 +1,5 @@
#! @BASH@
-# Copyright (C) 1999-2016 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
@@ -71,7 +71,7 @@ do_version() {
printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2016"
+" "2017"
printf $"Written by %s.
" "Ulrich Drepper"
exit 0
diff --git a/malloc/memusagestat.c b/malloc/memusagestat.c
index 7fb65d1..0bd158b 100644
--- a/malloc/memusagestat.c
+++ b/malloc/memusagestat.c
@@ -1,5 +1,5 @@
/* Generate graphic from memory profiling data.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -582,6 +582,6 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2016");
+"), "2017");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
diff --git a/malloc/morecore.c b/malloc/morecore.c
index 9e069ac..edfceda 100644
--- a/malloc/morecore.c
+++ b/malloc/morecore.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 501f014..800f2a8 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -1,5 +1,5 @@
/* More debugging hooks for `malloc'.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written April 2, 1991 by John Gilmore of Cygnus Support.
Based on mcheck.c by Mike Haertel.
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 3715a7f..4acbd81 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -1,7 +1,7 @@
#! @PERL@
eval "exec @PERL@ -S $0 $@"
if 0;
-# Copyright (C) 1997-2016 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@gnu.org>, 1997.
# Based on the mtrace.awk script.
@@ -45,7 +45,7 @@ arglist: while (@ARGV) {
$ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" ||
$ARGV[0] eq "--versio" || $ARGV[0] eq "--version") {
print "mtrace $PKGVERSION$VERSION\n";
- print "Copyright (C) 2016 Free Software Foundation, Inc.\n";
+ print "Copyright (C) 2017 Free Software Foundation, Inc.\n";
print "This is free software; see the source for copying conditions. There is NO\n";
print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
print "Written by Ulrich Drepper <drepper\@gnu.org>\n";
diff --git a/malloc/obstack.c b/malloc/obstack.c
index c0927bb..4ac8938 100644
--- a/malloc/obstack.c
+++ b/malloc/obstack.c
@@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988-2016 Free Software Foundation, Inc.
+ Copyright (C) 1988-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/obstack.h b/malloc/obstack.h
index 5716202..538837e 100644
--- a/malloc/obstack.h
+++ b/malloc/obstack.h
@@ -1,5 +1,5 @@
/* obstack.h - object stack macros
- Copyright (C) 1988-2016 Free Software Foundation, Inc.
+ Copyright (C) 1988-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/scratch_buffer_grow.c b/malloc/scratch_buffer_grow.c
index 4714754..22bae50 100644
--- a/malloc/scratch_buffer_grow.c
+++ b/malloc/scratch_buffer_grow.c
@@ -1,5 +1,5 @@
/* Variable-sized buffer with on-stack default allocation.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/scratch_buffer_grow_preserve.c b/malloc/scratch_buffer_grow_preserve.c
index 6aae41e..18543ef 100644
--- a/malloc/scratch_buffer_grow_preserve.c
+++ b/malloc/scratch_buffer_grow_preserve.c
@@ -1,5 +1,5 @@
/* Variable-sized buffer with on-stack default allocation.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/scratch_buffer_set_array_size.c b/malloc/scratch_buffer_set_array_size.c
index 9254c9a..8ab6d9d 100644
--- a/malloc/scratch_buffer_set_array_size.c
+++ b/malloc/scratch_buffer_set_array_size.c
@@ -1,5 +1,5 @@
/* Variable-sized buffer with on-stack default allocation.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c
index f614fd7..c9cdd81 100644
--- a/malloc/set-freeres.c
+++ b/malloc/set-freeres.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
index a8b5305..675c12d 100644
--- a/malloc/thread-freeres.c
+++ b/malloc/thread-freeres.c
@@ -1,5 +1,5 @@
/* Free resources stored in thread-local variables on thread exit.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-calloc.c b/malloc/tst-calloc.c
index 9a879f4..c423680 100644
--- a/malloc/tst-calloc.c
+++ b/malloc/tst-calloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>.
diff --git a/malloc/tst-interpose-aux-nothread.c b/malloc/tst-interpose-aux-nothread.c
index 0eae66f..804bac3 100644
--- a/malloc/tst-interpose-aux-nothread.c
+++ b/malloc/tst-interpose-aux-nothread.c
@@ -1,5 +1,5 @@
/* Interposed malloc, version without threading support.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-aux-thread.c b/malloc/tst-interpose-aux-thread.c
index 354e4d8..107ff2b 100644
--- a/malloc/tst-interpose-aux-thread.c
+++ b/malloc/tst-interpose-aux-thread.c
@@ -1,5 +1,5 @@
/* Interposed malloc, version with threading support.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-aux.c b/malloc/tst-interpose-aux.c
index 77866b2..535b055 100644
--- a/malloc/tst-interpose-aux.c
+++ b/malloc/tst-interpose-aux.c
@@ -1,5 +1,5 @@
/* Minimal malloc implementation for interposition tests.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-aux.h b/malloc/tst-interpose-aux.h
index 2fb22d3..1388a73 100644
--- a/malloc/tst-interpose-aux.h
+++ b/malloc/tst-interpose-aux.h
@@ -1,5 +1,5 @@
/* Statistics interface for the minimal malloc implementation.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-nothread.c b/malloc/tst-interpose-nothread.c
index 9acb572..6beea369 100644
--- a/malloc/tst-interpose-nothread.c
+++ b/malloc/tst-interpose-nothread.c
@@ -1,5 +1,5 @@
/* Malloc interposition test, dynamically-linked version without threads.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-skeleton.c b/malloc/tst-interpose-skeleton.c
index d1ebc9a..82a9078 100644
--- a/malloc/tst-interpose-skeleton.c
+++ b/malloc/tst-interpose-skeleton.c
@@ -1,5 +1,5 @@
/* Test driver for malloc interposition tests.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-static-nothread.c b/malloc/tst-interpose-static-nothread.c
index 3fb2dd8..ab3d464 100644
--- a/malloc/tst-interpose-static-nothread.c
+++ b/malloc/tst-interpose-static-nothread.c
@@ -1,5 +1,5 @@
/* Malloc interposition test, static version without threads.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-static-thread.c b/malloc/tst-interpose-static-thread.c
index c78ebc7..80ddcd4 100644
--- a/malloc/tst-interpose-static-thread.c
+++ b/malloc/tst-interpose-static-thread.c
@@ -1,5 +1,5 @@
/* Malloc interposition test, static version with threads.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-interpose-thread.c b/malloc/tst-interpose-thread.c
index d3e20c7..d09c959 100644
--- a/malloc/tst-interpose-thread.c
+++ b/malloc/tst-interpose-thread.c
@@ -1,5 +1,5 @@
/* Malloc interposition test, dynamically-linked version with threads.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-malloc-backtrace.c b/malloc/tst-malloc-backtrace.c
index 3aee7fd..012ff81 100644
--- a/malloc/tst-malloc-backtrace.c
+++ b/malloc/tst-malloc-backtrace.c
@@ -1,5 +1,5 @@
/* Verify that backtrace does not deadlock on itself on memory corruption.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,9 +16,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-
+#include <signal.h>
#include <stdlib.h>
+#include <support/support.h>
+
#define SIZE 4096
/* Wrap free with a function to prevent gcc from optimizing it out. */
@@ -30,13 +32,6 @@ call_free (void *ptr)
*(size_t *)(ptr - sizeof (size_t)) = 1;
}
-int do_test (void);
-
-#define TEST_FUNCTION do_test ()
-#define EXPECTED_SIGNAL SIGABRT
-
-#include "../test-skeleton.c"
-
int
do_test (void)
{
@@ -53,3 +48,6 @@ do_test (void)
doesn't optimize out that malloc call. */
return (ptr1 == ptr2);
}
+
+#define EXPECTED_SIGNAL SIGABRT
+#include <support/test-driver.c>
diff --git a/malloc/tst-malloc-fork-deadlock.c b/malloc/tst-malloc-fork-deadlock.c
index 94549ca..30d3df3 100644
--- a/malloc/tst-malloc-fork-deadlock.c
+++ b/malloc/tst-malloc-fork-deadlock.c
@@ -1,5 +1,5 @@
/* Test concurrent fork, getline, and fflush (NULL).
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,9 +28,9 @@
#include <string.h>
#include <signal.h>
-static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/xthread.h>
+#include <support/temp_file.h>
+#include <support/test-driver.h>
enum {
/* Number of threads which call fork. */
@@ -117,30 +117,14 @@ static void
create_threads (pthread_t *threads, size_t count, void *(*func) (void *))
{
for (size_t i = 0; i < count; ++i)
- {
- int ret = pthread_create (threads + i, NULL, func, NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_create: %m\n");
- abort ();
- }
- }
+ threads[i] = xpthread_create (NULL, func, NULL);
}
static void
join_threads (pthread_t *threads, size_t count)
{
for (size_t i = 0; i < count; ++i)
- {
- int ret = pthread_join (threads[i], NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_join: %m\n");
- abort ();
- }
- }
+ xpthread_join (threads[i]);
}
/* Create a file which consists of a single long line, and assigns
@@ -189,8 +173,8 @@ do_test (void)
/* Leave some room for shutting down all threads gracefully. */
int timeout = 3;
- if (timeout > TIMEOUT)
- timeout = TIMEOUT - 1;
+ if (timeout > DEFAULT_TIMEOUT)
+ timeout = DEFAULT_TIMEOUT - 1;
create_file_with_large_line ();
@@ -218,3 +202,5 @@ do_test (void)
return 0;
}
+
+#include <support/test-driver.c>
diff --git a/malloc/tst-malloc-thread-exit.c b/malloc/tst-malloc-thread-exit.c
index fa6ebf9..8a0909b 100644
--- a/malloc/tst-malloc-thread-exit.c
+++ b/malloc/tst-malloc-thread-exit.c
@@ -1,5 +1,5 @@
/* Test malloc with concurrent thread termination.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,10 +33,9 @@
#include <stdlib.h>
#include <unistd.h>
-static int do_test (void);
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/support.h>
+#include <support/xthread.h>
+#include <support/test-driver.h>
static bool termination_requested;
static int inner_thread_count = 4;
@@ -53,19 +52,8 @@ static void *
malloc_first_thread (void * closure)
{
pthread_barrier_t *barrier = closure;
- void *ptr = malloc (malloc_size);
- if (ptr == NULL)
- {
- printf ("error: malloc: %m\n");
- abort ();
- }
- int ret = pthread_barrier_wait (barrier);
- if (ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD)
- {
- errno = ret;
- printf ("error: pthread_barrier_wait: %m\n");
- abort ();
- }
+ void *ptr = xmalloc (malloc_size);
+ xpthread_barrier_wait (barrier);
unoptimized_free (ptr);
return NULL;
}
@@ -74,19 +62,8 @@ static void *
wait_first_thread (void * closure)
{
pthread_barrier_t *barrier = closure;
- int ret = pthread_barrier_wait (barrier);
- if (ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD)
- {
- errno = ret;
- printf ("error: pthread_barrier_wait: %m\n");
- abort ();
- }
- void *ptr = malloc (malloc_size);
- if (ptr == NULL)
- {
- printf ("error: malloc: %m\n");
- abort ();
- }
+ xpthread_barrier_wait (barrier);
+ void *ptr = xmalloc (malloc_size);
unoptimized_free (ptr);
return NULL;
}
@@ -94,23 +71,11 @@ wait_first_thread (void * closure)
static void *
outer_thread (void *closure)
{
- pthread_t *threads = calloc (sizeof (*threads), inner_thread_count);
- if (threads == NULL)
- {
- printf ("error: calloc: %m\n");
- abort ();
- }
-
+ pthread_t *threads = xcalloc (sizeof (*threads), inner_thread_count);
while (!__atomic_load_n (&termination_requested, __ATOMIC_RELAXED))
{
pthread_barrier_t barrier;
- int ret = pthread_barrier_init (&barrier, NULL, inner_thread_count + 1);
- if (ret != 0)
- {
- errno = ret;
- printf ("pthread_barrier_init: %m\n");
- abort ();
- }
+ xpthread_barrier_init (&barrier, NULL, inner_thread_count + 1);
for (int i = 0; i < inner_thread_count; ++i)
{
void *(*func) (void *);
@@ -118,38 +83,12 @@ outer_thread (void *closure)
func = malloc_first_thread;
else
func = wait_first_thread;
- ret = pthread_create (threads + i, NULL, func, &barrier);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_create: %m\n");
- abort ();
- }
- }
- ret = pthread_barrier_wait (&barrier);
- if (ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD)
- {
- errno = ret;
- printf ("pthread_wait: %m\n");
- abort ();
+ threads[i] = xpthread_create (NULL, func, &barrier);
}
+ xpthread_barrier_wait (&barrier);
for (int i = 0; i < inner_thread_count; ++i)
- {
- ret = pthread_join (threads[i], NULL);
- if (ret != 0)
- {
- ret = errno;
- printf ("error: pthread_join: %m\n");
- abort ();
- }
- }
- ret = pthread_barrier_destroy (&barrier);
- if (ret != 0)
- {
- ret = errno;
- printf ("pthread_barrier_destroy: %m\n");
- abort ();
- }
+ xpthread_join (threads[i]);
+ xpthread_barrier_destroy (&barrier);
}
free (threads);
@@ -172,26 +111,12 @@ do_test (void)
/* Leave some room for shutting down all threads gracefully. */
int timeout = 3;
- if (timeout > TIMEOUT)
- timeout = TIMEOUT - 1;
-
- pthread_t *threads = calloc (sizeof (*threads), outer_thread_count);
- if (threads == NULL)
- {
- printf ("error: calloc: %m\n");
- abort ();
- }
+ if (timeout > DEFAULT_TIMEOUT)
+ timeout = DEFAULT_TIMEOUT - 1;
+ pthread_t *threads = xcalloc (sizeof (*threads), outer_thread_count);
for (long i = 0; i < outer_thread_count; ++i)
- {
- int ret = pthread_create (threads + i, NULL, outer_thread, NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_create: %m\n");
- abort ();
- }
- }
+ threads[i] = xpthread_create (NULL, outer_thread, NULL);
struct timespec ts = {timeout, 0};
if (nanosleep (&ts, NULL))
@@ -203,16 +128,10 @@ do_test (void)
__atomic_store_n (&termination_requested, true, __ATOMIC_RELAXED);
for (long i = 0; i < outer_thread_count; ++i)
- {
- int ret = pthread_join (threads[i], NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_join: %m\n");
- abort ();
- }
- }
+ xpthread_join (threads[i]);
free (threads);
return 0;
}
+
+#include <support/test-driver.c>
diff --git a/malloc/tst-malloc-thread-fail.c b/malloc/tst-malloc-thread-fail.c
index fca0eb8..2745a33 100644
--- a/malloc/tst-malloc-thread-fail.c
+++ b/malloc/tst-malloc-thread-fail.c
@@ -1,5 +1,5 @@
/* Test allocation function behavior on allocation failure.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -436,7 +436,7 @@ do_test (void)
}
/* The repeated allocations take some time on slow machines. */
-#define TIMEOUT 30
+#define TIMEOUT 100
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
diff --git a/malloc/tst-malloc-usable-static-tunables.c b/malloc/tst-malloc-usable-static-tunables.c
new file mode 100644
index 0000000..8907db0
--- /dev/null
+++ b/malloc/tst-malloc-usable-static-tunables.c
@@ -0,0 +1 @@
+#include <malloc/tst-malloc-usable.c>
diff --git a/malloc/tst-malloc-usable-static.c b/malloc/tst-malloc-usable-static.c
new file mode 100644
index 0000000..8907db0
--- /dev/null
+++ b/malloc/tst-malloc-usable-static.c
@@ -0,0 +1 @@
+#include <malloc/tst-malloc-usable.c>
diff --git a/malloc/tst-malloc-usable-tunables.c b/malloc/tst-malloc-usable-tunables.c
new file mode 100644
index 0000000..8907db0
--- /dev/null
+++ b/malloc/tst-malloc-usable-tunables.c
@@ -0,0 +1 @@
+#include <malloc/tst-malloc-usable.c>
diff --git a/malloc/tst-malloc-usable.c b/malloc/tst-malloc-usable.c
index ca67ed7..6a64d20 100644
--- a/malloc/tst-malloc-usable.c
+++ b/malloc/tst-malloc-usable.c
@@ -1,7 +1,7 @@
/* Ensure that malloc_usable_size returns the request size with
MALLOC_CHECK_ exported to a positive value.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
index c1292a2..740ac6c 100644
--- a/malloc/tst-malloc.c
+++ b/malloc/tst-malloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1999.
@@ -19,6 +19,7 @@
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
+#include <libc-internal.h>
static int errors = 0;
@@ -37,7 +38,14 @@ do_test (void)
errno = 0;
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
p = malloc (-1);
+ DIAG_POP_NEEDS_COMMENT;
save = errno;
if (p != NULL)
@@ -67,7 +75,14 @@ do_test (void)
if (p == NULL)
merror ("malloc (513K) failed.");
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
q = malloc (-512 * 1024);
+ DIAG_POP_NEEDS_COMMENT;
if (q != NULL)
merror ("malloc (-512K) succeeded.");
diff --git a/malloc/tst-mallocfork2.c b/malloc/tst-mallocfork2.c
index 109c1b9..bb6a331 100644
--- a/malloc/tst-mallocfork2.c
+++ b/malloc/tst-mallocfork2.c
@@ -1,5 +1,5 @@
/* Test case for async-signal-safe fork (with respect to malloc).
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -45,6 +45,7 @@ enum { malloc_maximum_size = 70000 };
enum { signal_count = 1000 };
static int do_test (void);
+#define TIMEOUT 100
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c
index 7e081c5..5cb39c0 100644
--- a/malloc/tst-mallocstate.c
+++ b/malloc/tst-mallocstate.c
@@ -1,5 +1,5 @@
/* Emulate Emacs heap dumping to test malloc_set_state.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
diff --git a/malloc/tst-mallopt.c b/malloc/tst-mallopt.c
index 390fba3..37f6c4c 100644
--- a/malloc/tst-mallopt.c
+++ b/malloc/tst-mallopt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-mcheck.c b/malloc/tst-mcheck.c
index 296cc47..2e3cba9 100644
--- a/malloc/tst-mcheck.c
+++ b/malloc/tst-mcheck.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
@@ -19,6 +19,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libc-internal.h>
static int errors = 0;
@@ -36,7 +37,14 @@ do_test (void)
errno = 0;
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
p = malloc (-1);
+ DIAG_POP_NEEDS_COMMENT;
if (p != NULL)
merror ("malloc (-1) succeeded.");
@@ -67,10 +75,17 @@ do_test (void)
if (p == NULL)
merror ("malloc (512) failed.");
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
if (realloc (p, -256) != NULL)
merror ("realloc (p, -256) succeeded.");
else if (errno != ENOMEM)
merror ("errno is not set correctly.");
+ DIAG_POP_NEEDS_COMMENT;
free (p);
@@ -78,10 +93,17 @@ do_test (void)
if (p == NULL)
merror ("malloc (512) failed.");
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
if (realloc (p, -1) != NULL)
merror ("realloc (p, -1) succeeded.");
else if (errno != ENOMEM)
merror ("errno is not set correctly.");
+ DIAG_POP_NEEDS_COMMENT;
free (p);
free (q);
diff --git a/malloc/tst-memalign.c b/malloc/tst-memalign.c
index 6650610..b403464 100644
--- a/malloc/tst-memalign.c
+++ b/malloc/tst-memalign.c
@@ -1,5 +1,5 @@
/* Test for memalign.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-mtrace.c b/malloc/tst-mtrace.c
index fc44226..2726c68 100644
--- a/malloc/tst-mtrace.c
+++ b/malloc/tst-mtrace.c
@@ -1,5 +1,5 @@
/* Test program for mtrace.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-mtrace.sh b/malloc/tst-mtrace.sh
index cbcaea8..6ab799f 100755
--- a/malloc/tst-mtrace.sh
+++ b/malloc/tst-mtrace.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Testing the mtrace function.
-# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+# Copyright (C) 2000-2017 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-posix_memalign.c b/malloc/tst-posix_memalign.c
index 0545599..31573b6 100644
--- a/malloc/tst-posix_memalign.c
+++ b/malloc/tst-posix_memalign.c
@@ -1,5 +1,5 @@
/* Test for posix_memalign.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-pvalloc.c b/malloc/tst-pvalloc.c
index ffce702..00f1952 100644
--- a/malloc/tst-pvalloc.c
+++ b/malloc/tst-pvalloc.c
@@ -1,5 +1,5 @@
/* Test for pvalloc.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-realloc.c b/malloc/tst-realloc.c
index 16e840f..7f1f228 100644
--- a/malloc/tst-realloc.c
+++ b/malloc/tst-realloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
#include <malloc.h>
#include <stdio.h>
#include <string.h>
+#include <libc-internal.h>
static int errors = 0;
@@ -39,7 +40,14 @@ do_test (void)
errno = 0;
/* realloc (NULL, ...) behaves similarly to malloc (C89). */
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
p = realloc (NULL, -1);
+ DIAG_POP_NEEDS_COMMENT;
save = errno;
if (p != NULL)
@@ -111,7 +119,14 @@ do_test (void)
merror ("first 16 bytes were not correct");
/* Check failed realloc leaves original untouched (C89). */
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we want to test
+ that they fail. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
c = realloc (p, -1);
+ DIAG_POP_NEEDS_COMMENT;
if (c != NULL)
merror ("realloc (p, -1) succeeded.");
diff --git a/malloc/tst-scratch_buffer.c b/malloc/tst-scratch_buffer.c
index 073a6db..5c9f344 100644
--- a/malloc/tst-scratch_buffer.c
+++ b/malloc/tst-scratch_buffer.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/malloc/tst-valloc.c b/malloc/tst-valloc.c
index afcb1e5..57161f6 100644
--- a/malloc/tst-valloc.c
+++ b/malloc/tst-valloc.c
@@ -1,5 +1,5 @@
/* Test for valloc.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or