Skip to content

Commit d837725

Browse files
committed
posix: posix_types.h: simplify conditions on pthread types
Simplify the conditions for pthread type declaration Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent 4cb3579 commit d837725

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

include/zephyr/posix/posix_types.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ struct pthread_attr {
8787
uint32_t details[2];
8888
};
8989

90-
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
91-
|| defined(CONFIG_ARCMWDT_LIBC)
90+
#if !defined(CONFIG_NEWLIB_LIBC)
9291
typedef struct pthread_attr pthread_attr_t;
93-
#endif
94-
9592
BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
93+
#endif
9694

9795
typedef uint32_t pthread_t;
9896
typedef uint32_t pthread_spinlock_t;
@@ -107,11 +105,10 @@ struct pthread_mutexattr {
107105
unsigned char type: 2;
108106
bool initialized: 1;
109107
};
110-
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
111-
|| defined(CONFIG_ARCMWDT_LIBC)
108+
#if !defined(CONFIG_NEWLIB_LIBC)
112109
typedef struct pthread_mutexattr pthread_mutexattr_t;
113-
#endif
114110
BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
111+
#endif
115112

116113
/* Condition variables */
117114
typedef uint32_t pthread_cond_t;
@@ -120,11 +117,10 @@ struct pthread_condattr {
120117
clockid_t clock;
121118
};
122119

123-
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
124-
|| defined(CONFIG_ARCMWDT_LIBC)
120+
#if !defined(CONFIG_NEWLIB_LIBC)
125121
typedef struct pthread_condattr pthread_condattr_t;
126-
#endif
127122
BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
123+
#endif
128124

129125
/* Barrier */
130126
typedef uint32_t pthread_barrier_t;
@@ -141,14 +137,12 @@ struct pthread_once {
141137
bool flag;
142138
};
143139

144-
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
145-
|| defined(CONFIG_ARCMWDT_LIBC)
140+
#if !defined(CONFIG_NEWLIB_LIBC)
146141
typedef uint32_t pthread_key_t;
147142
typedef struct pthread_once pthread_once_t;
148-
#endif
149-
150143
/* Newlib typedefs pthread_once_t as a struct with two ints */
151144
BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
145+
#endif
152146

153147
#ifdef __cplusplus
154148
}

0 commit comments

Comments
 (0)