posix: posix_types.h: simplify conditions on pthread types

Simplify the conditions for pthread type declaration

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt 2024-07-13 21:24:14 -04:00 committed by Anas Nashif
parent 6667b500c6
commit 6cf557d64a

View file

@ -87,12 +87,10 @@ struct pthread_attr {
uint32_t details[2];
};
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
|| defined(CONFIG_ARCMWDT_LIBC)
#if !defined(CONFIG_NEWLIB_LIBC)
typedef struct pthread_attr pthread_attr_t;
#endif
BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
#endif
typedef uint32_t pthread_t;
typedef uint32_t pthread_spinlock_t;
@ -107,11 +105,10 @@ struct pthread_mutexattr {
unsigned char type: 2;
bool initialized: 1;
};
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
|| defined(CONFIG_ARCMWDT_LIBC)
#if !defined(CONFIG_NEWLIB_LIBC)
typedef struct pthread_mutexattr pthread_mutexattr_t;
#endif
BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
#endif
/* Condition variables */
typedef uint32_t pthread_cond_t;
@ -120,11 +117,10 @@ struct pthread_condattr {
clockid_t clock;
};
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
|| defined(CONFIG_ARCMWDT_LIBC)
#if !defined(CONFIG_NEWLIB_LIBC)
typedef struct pthread_condattr pthread_condattr_t;
#endif
BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
#endif
/* Barrier */
typedef uint32_t pthread_barrier_t;
@ -141,14 +137,12 @@ struct pthread_once {
bool flag;
};
#if defined(CONFIG_MINIMAL_LIBC) || defined(CONFIG_PICOLIBC) || defined(CONFIG_ARMCLANG_STD_LIBC) \
|| defined(CONFIG_ARCMWDT_LIBC)
#if !defined(CONFIG_NEWLIB_LIBC)
typedef uint32_t pthread_key_t;
typedef struct pthread_once pthread_once_t;
#endif
/* Newlib typedefs pthread_once_t as a struct with two ints */
BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
#endif
#ifdef __cplusplus
}