+2019-06-10 Joseph Myers <joseph@codesourcery.com>
+
+ * 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.
+
2019-06-07 Florian Weimer <fweimer@redhat.com>
Linux: Add getdents64 system call.
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
+#include <libc-diag.h>
/* Number of samples per size. */
null_test (void)
{
/* If the size is 0 the result is implementation defined. Just make
- sure the program doesn't crash. */
+ sure the program doesn't crash. The result of calloc is
+ deliberately ignored, so do not warn about that. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (10, "-Wunused-result");
calloc (0, 0);
calloc (0, UINT_MAX);
calloc (UINT_MAX, 0);
calloc (0, ~((size_t) 0));
calloc (~((size_t) 0), 0);
+ DIAG_POP_NEEDS_COMMENT;
}
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <libc-diag.h>
static void
sig_handler (int signum)
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)
{