summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguozhanxin <[email protected]>2022-04-21 10:31:32 +0800
committerguo <[email protected]>2022-04-21 14:35:11 +0800
commit7a717b094e4260682c9cc5157b32544113b01c7e (patch)
tree07a4acab69d5457db5567ef9e70f5121f74c59b0
parent1404186602f75fb5fe142681a66c41c185b2fcb8 (diff)
[fix] building error.
-rw-r--r--components/libc/cplusplus/cpp11/emutls.c9
-rw-r--r--components/libc/posix/pthreads/pthread.h6
-rw-r--r--examples/utest/testcases/cpp11/Kconfig2
3 files changed, 5 insertions, 12 deletions
diff --git a/components/libc/cplusplus/cpp11/emutls.c b/components/libc/cplusplus/cpp11/emutls.c
index 576888f16f..bba3c4a8e0 100644
--- a/components/libc/cplusplus/cpp11/emutls.c
+++ b/components/libc/cplusplus/cpp11/emutls.c
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <string.h>
-#define COMPILE_TIME_ASSERT(x)
-
extern int pthread_key_create(pthread_key_t *key, void (*destructor)(void *));
extern int pthread_key_delete(pthread_key_t key);
extern void *pthread_getspecific(pthread_key_t key);
@@ -85,13 +83,6 @@ static __inline void emutls_memalign_free(void *base)
/* Emulated TLS objects are always allocated at run-time. */
static __inline void *emutls_allocate_object(__emutls_control *control)
{
- /* Use standard C types, check with gcc's emutls.o. */
- typedef unsigned int gcc_word __attribute__((mode(word)));
- typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
- COMPILE_TIME_ASSERT(sizeof(size_t) == sizeof(gcc_word));
- COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(gcc_pointer));
- COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(void *));
-
size_t size = control->size;
size_t align = control->align;
if (align < sizeof(void *))
diff --git a/components/libc/posix/pthreads/pthread.h b/components/libc/posix/pthreads/pthread.h
index c170ec49fd..1a27eae6e2 100644
--- a/components/libc/posix/pthreads/pthread.h
+++ b/components/libc/posix/pthreads/pthread.h
@@ -22,9 +22,9 @@ extern "C" {
#define PTHREAD_KEY_MAX 8
-#define PTHREAD_COND_INITIALIZER {-1, 0}
-#define PTHREAD_RWLOCK_INITIALIZER {-1, 0}
-#define PTHREAD_MUTEX_INITIALIZER {-1, 0}
+#define PTHREAD_COND_INITIALIZER {-1}
+#define PTHREAD_RWLOCK_INITIALIZER {-1}
+#define PTHREAD_MUTEX_INITIALIZER {-1}
#define PTHREAD_CREATE_JOINABLE 0x00
#define PTHREAD_CREATE_DETACHED 0x01
diff --git a/examples/utest/testcases/cpp11/Kconfig b/examples/utest/testcases/cpp11/Kconfig
index 1d08163d13..f628309c84 100644
--- a/examples/utest/testcases/cpp11/Kconfig
+++ b/examples/utest/testcases/cpp11/Kconfig
@@ -2,6 +2,8 @@ menu "CPP11 Testcase"
config UTEST_CPP11_THREAD_TC
bool "Cpp11 thread test"
+ select RT_USING_CPLUSPLUS
+ select RT_USING_CPLUSPLUS11
default n
endmenu