From d15e18aa5db53f55344bbb4a7623d3dd46b6ad0f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 28 Mar 2019 19:22:37 +0800 Subject: [PATCH] newlib: fixes for compatibility with newlib 3.0 --- components/newlib/platform_include/sys/select.h | 6 ++++++ components/newlib/reent_init.c | 1 - components/pthread/pthread.c | 3 ++- components/wpa_supplicant/port/include/endian.h | 5 +---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/newlib/platform_include/sys/select.h b/components/newlib/platform_include/sys/select.h index 199d48144..ca7e4a4a2 100644 --- a/components/newlib/platform_include/sys/select.h +++ b/components/newlib/platform_include/sys/select.h @@ -15,7 +15,11 @@ #ifndef __ESP_SYS_SELECT_H__ #define __ESP_SYS_SELECT_H__ +/* Newlib 2.2.0 does not provide sys/select.h, and fd_set is defined in sys/types.h */ #include +#ifndef fd_set +#include_next +#else // fd_set #include #ifdef __cplusplus @@ -28,4 +32,6 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct } // extern "C" #endif +#endif // fd_set + #endif //__ESP_SYS_SELECT_H__ diff --git a/components/newlib/reent_init.c b/components/newlib/reent_init.c index 5c29e898c..638d10be2 100644 --- a/components/newlib/reent_init.c +++ b/components/newlib/reent_init.c @@ -41,5 +41,4 @@ void IRAM_ATTR esp_reent_init(struct _reent* r) r->__sglue._next = NULL; r->__sglue._niobs = 0; r->__sglue._iobs = NULL; - r->_current_locale = "C"; } diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index 99e5d209e..2bdfb3b72 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -460,7 +460,8 @@ void pthread_exit(void *value_ptr) vTaskSuspend(NULL); } - ESP_LOGV(TAG, "%s EXIT", __FUNCTION__); + // Should never be reached + abort(); } int pthread_cancel(pthread_t thread) diff --git a/components/wpa_supplicant/port/include/endian.h b/components/wpa_supplicant/port/include/endian.h index f84f923ca..0d0d4f5ba 100644 --- a/components/wpa_supplicant/port/include/endian.h +++ b/components/wpa_supplicant/port/include/endian.h @@ -83,10 +83,7 @@ typedef __uint64_t uint64_t; * Host to big endian, host to little endian, big endian to host, and little * endian to host byte order functions as detailed in byteorder(9). */ -#if 1 //BYTE_ORDER == _LITTLE_ENDIAN -#define __bswap16 __bswap_16 -#define __bswap32 __bswap_32 -#define __bswap64 __bswap_64 +#if BYTE_ORDER == _LITTLE_ENDIAN #define htobe16(x) bswap16((x)) #define htobe32(x) bswap32((x)) #define htobe64(x) bswap64((x))