tests: posix: net: fix missing clock_t and clockid_t with newlib
Fix errors found in CI for missing clock_t and clockid_t types when building the tests/posix/net testsuite against newlib. Also use angle-brackets and prefixed path with `<zephyr/posix/posix_types.h>` since it is not in the default search path and is analagous to `<sys/types.h>`. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
091c6664c5
commit
b302212c5a
10 changed files with 24 additions and 8 deletions
|
@ -7,7 +7,8 @@
|
||||||
#define ZEPHYR_INCLUDE_POSIX_DIRENT_H_
|
#define ZEPHYR_INCLUDE_POSIX_DIRENT_H_
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "posix_types.h"
|
|
||||||
|
#include <zephyr/posix/posix_types.h>
|
||||||
|
|
||||||
#ifdef CONFIG_POSIX_FILE_SYSTEM
|
#ifdef CONFIG_POSIX_FILE_SYSTEM
|
||||||
#include <zephyr/fs/fs.h>
|
#include <zephyr/fs/fs.h>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <zephyr/posix/fcntl.h>
|
#include <zephyr/posix/fcntl.h>
|
||||||
#include <zephyr/posix/signal.h>
|
#include <zephyr/posix/signal.h>
|
||||||
#include <zephyr/posix/sys/stat.h>
|
#include <zephyr/posix/sys/stat.h>
|
||||||
#include "posix_types.h"
|
#include <zephyr/posix/posix_types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -11,6 +11,18 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_CLOCK_T_DECLARED) && !defined(__clock_t_defined)
|
||||||
|
typedef unsigned long clock_t;
|
||||||
|
#define _CLOCK_T_DECLARED
|
||||||
|
#define __clock_t_defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_CLOCKID_T_DECLARED) && !defined(__clockid_t_defined)
|
||||||
|
typedef unsigned long clockid_t;
|
||||||
|
#define _CLOCKID_T_DECLARED
|
||||||
|
#define __clockid_t_defined
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NEWLIB_LIBC
|
#ifdef CONFIG_NEWLIB_LIBC
|
||||||
#include <sys/_pthreadtypes.h>
|
#include <sys/_pthreadtypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
#define ZEPHYR_INCLUDE_POSIX_SCHED_H_
|
#define ZEPHYR_INCLUDE_POSIX_SCHED_H_
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/posix/posix_types.h>
|
||||||
#include "posix_types.h"
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define ZEPHYR_INCLUDE_POSIX_SEMAPHORE_H_
|
#define ZEPHYR_INCLUDE_POSIX_SEMAPHORE_H_
|
||||||
|
|
||||||
#include <zephyr/posix/time.h>
|
#include <zephyr/posix/time.h>
|
||||||
#include "posix_types.h"
|
#include <zephyr/posix/posix_types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
|
#ifndef ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
|
||||||
#define ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
|
#define ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
|
||||||
|
|
||||||
#include "posix_types.h"
|
/* include posix_types.h before posix_features.h (here) to avoid build errors against newlib */
|
||||||
|
#include <zephyr/posix/posix_types.h>
|
||||||
#include "posix_features.h"
|
#include "posix_features.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
|
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
|
||||||
#define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
|
#define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
|
||||||
|
|
||||||
|
#include <zephyr/posix/posix_types.h>
|
||||||
#include <zephyr/sys/fdtable.h>
|
#include <zephyr/sys/fdtable.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct itimerspec {
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "posix_types.h"
|
#include <zephyr/posix/posix_types.h>
|
||||||
#include <zephyr/posix/signal.h>
|
#include <zephyr/posix/signal.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
#ifndef ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
||||||
#define ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
#define ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
||||||
|
|
||||||
#include "posix_types.h"
|
#include <zephyr/posix/posix_types.h>
|
||||||
|
|
||||||
#ifdef CONFIG_POSIX_API
|
#ifdef CONFIG_POSIX_API
|
||||||
#include <zephyr/fs/fs.h>
|
#include <zephyr/fs/fs.h>
|
||||||
|
|
|
@ -7,3 +7,5 @@ project(posix_net)
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
|
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
||||||
|
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue