Skip to content

Commit 962e42c

Browse files
keith-packardcarlescufi
authored andcommitted
tests, samples: Define _POSIX_C_SOURCE where needed
Various tests and samples use POSIX-only functions. Define _POSIX_C_SOURCE to ensure they are visible. Signed-off-by: Keith Packard <[email protected]>
1 parent 6e1210a commit 962e42c

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

samples/posix/gettimeofday/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#undef _POSIX_C_SOURCE
8+
#define _POSIX_C_SOURCE 200809L
79
#include <stdio.h>
810
#include <stdlib.h>
911
#include <errno.h>

tests/lib/c_lib/common/src/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
* it guarantee that ALL functionality provided is working correctly.
1616
*/
1717

18-
#if defined(CONFIG_NATIVE_LIBC)
1918
#undef _POSIX_C_SOURCE
2019
#define _POSIX_C_SOURCE 200809L
21-
#endif
2220

2321
#include <zephyr/kernel.h>
2422
#include <zephyr/sys/__assert.h>

tests/posix/fs/src/test_fs_dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#undef _POSIX_C_SOURCE
8+
#define _POSIX_C_SOURCE 200809L
9+
710
#include <stdio.h>
811
#include <fcntl.h>
912
#include <zephyr/posix/unistd.h>

tests/posix/fs/src/test_fs_stat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#undef _POSIX_C_SOURCE
8+
#define _POSIX_C_SOURCE 200809L
9+
710
#include <string.h>
811
#include <zephyr/posix/fcntl.h>
912
#include <zephyr/posix/unistd.h>

0 commit comments

Comments
 (0)