Skip to content

Commit 623a6d9

Browse files
keith-packardmbolivar-nordic
authored andcommitted
tests/mem_alloc: Eliminate alloc warnings. Define _BSD_SOURCE
We need to keep gcc from complaining about large calloc/malloc/realloc sizes as that's what we're testing. Define _BSD_SOURCE so that libraries sharing the glibc convention (like newlib and picolibc) for controlling the API level visible to applications will declare reallocarray(3), which is an OpenBSD extension to the C library. Signed-off-by: Keith Packard <[email protected]>
1 parent d24e975 commit 623a6d9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/lib/mem_alloc/src/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
* it guarantee that ALL functionality provided is working correctly.
1717
*/
1818

19+
#if defined(__GNUC__)
20+
/*
21+
* Don't complain about ridiculous alloc size requests
22+
*/
23+
#pragma GCC diagnostic push
24+
#pragma GCC diagnostic ignored "-Walloc-size-larger-than="
25+
#endif
26+
27+
#define _BSD_SOURCE
1928
#include <zephyr/zephyr.h>
2029
#include <ztest.h>
2130
#include <stdlib.h>

0 commit comments

Comments
 (0)