aboutsummaryrefslogtreecommitdiff
path: root/malloc/tst-mallocfork.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-06-10 22:12:08 +0000
committerJoseph Myers <joseph@codesourcery.com>2019-06-10 22:12:08 +0000
commite6e24243905957c36596f50a22af0acfd83793e2 (patch)
tree59a8709521107ec13118a52a96488501c5608b67 /malloc/tst-mallocfork.c
parent51ea67d54882318c4fa5394c386f4816ddc22408 (diff)
downloadglibc-e6e24243905957c36596f50a22af0acfd83793e2.zip
glibc-e6e24243905957c36596f50a22af0acfd83793e2.tar.gz
glibc-e6e24243905957c36596f50a22af0acfd83793e2.tar.bz2
Fix malloc tests build with GCC 10.
GCC mainline has recently added warn_unused_result attributes to some malloc-like built-in functions, where glibc previously had them in its headers only for __USE_FORTIFY_LEVEL > 0. This results in those attributes being newly in effect for building the glibc testsuite, so resulting in new warnings that break the build where tests deliberately call such functions and ignore the result. Thus patch duly adds calls to DIAG_* macros around those calls to disable the warning. Tested with build-many-glibcs.py for aarch64-linux-gnu. * malloc/tst-calloc.c: Include <libc-diag.h>. (null_test): Ignore -Wunused-result around calls to calloc. * malloc/tst-mallocfork.c: Include <libc-diag.h>. (do_test): Ignore -Wunused-result around call to malloc.
Diffstat (limited to 'malloc/tst-mallocfork.c')
-rw-r--r--malloc/tst-mallocfork.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/malloc/tst-mallocfork.c b/malloc/tst-mallocfork.c
index 4ff6ec0..00851a1 100644
--- a/malloc/tst-mallocfork.c
+++ b/malloc/tst-mallocfork.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <libc-diag.h>
static void
sig_handler (int signum)
@@ -25,7 +26,12 @@ do_test (void)
struct sigaction action = { .sa_handler = sig_handler };
sigemptyset (&action.sa_mask);
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (10, "-Wunused-result");
+ /* The result of malloc is deliberately ignored, so do not warn
+ about that. */
malloc (sizeof (int));
+ DIAG_POP_NEEDS_COMMENT;
if (sigaction (SIGALRM, &action, NULL) != 0)
{