mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(newlib): adapt changes
This commit is contained in:
41
components/newlib/platform_include/ctype.h
Normal file
41
components/newlib/platform_include/ctype.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include_next <ctype.h>
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
|
||||
#ifndef _U
|
||||
#define _U __CTYPE_UPPER
|
||||
#endif
|
||||
|
||||
#ifndef _L
|
||||
#define _L __CTYPE_LOWER
|
||||
#endif
|
||||
|
||||
#ifndef _N
|
||||
#define _N __CTYPE_DIGIT
|
||||
#endif
|
||||
|
||||
#ifndef _S
|
||||
#define _S __CTYPE_SPACE
|
||||
#endif
|
||||
|
||||
#ifndef _P
|
||||
#define _P __CTYPE_PUNCT
|
||||
#endif
|
||||
|
||||
#ifndef _C
|
||||
#define _C __CTYPE_CNTRL
|
||||
#endif
|
||||
|
||||
#ifndef _X
|
||||
#define _X __CTYPE_HEX
|
||||
#endif
|
||||
|
||||
#ifndef _B
|
||||
#define _B __CTYPE_BLANK
|
||||
#endif
|
||||
#endif
|
||||
20
components/newlib/platform_include/stdatomic.h
Normal file
20
components/newlib/platform_include/stdatomic.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
#include_next <stdatomic.h>
|
||||
|
||||
/* The ATOMIC_VAR_INIT macro was deprecated in:
|
||||
* - C17
|
||||
* - C++20
|
||||
* and removed in subsequent standards.
|
||||
* Since users may change the standard version for their projects,
|
||||
* IDF should remain compatible across different standards.
|
||||
*/
|
||||
#if __STDC_VERSION__ > 201710L || __cplusplus > 202002L
|
||||
# ifndef ATOMIC_VAR_INIT
|
||||
# define ATOMIC_VAR_INIT(val) (val)
|
||||
# endif
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifdef __clang__ // TODO LLVM-330
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/**
|
||||
* This header file provides POSIX-compatible definitions of directory
|
||||
* access data types. Starting with newlib 3.3, related functions are defined
|
||||
* in 'dirent.h' bundled with newlib.
|
||||
* See http://pubs.opengroup.org/onlinepubs/7908799/xsh/dirent.h.html
|
||||
* for reference.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Opaque directory structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t dd_vfs_idx; /*!< VFS index, not to be used by applications */
|
||||
uint16_t dd_rsv; /*!< field reserved for future extension */
|
||||
/* remaining fields are defined by VFS implementation */
|
||||
} DIR;
|
||||
|
||||
/**
|
||||
* @brief Directory entry structure
|
||||
*/
|
||||
struct dirent {
|
||||
ino_t d_ino; /*!< file number */
|
||||
uint8_t d_type; /*!< not defined in POSIX, but present in BSD and Linux */
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_REG 1
|
||||
#define DT_DIR 2
|
||||
#if __BSD_VISIBLE
|
||||
#define MAXNAMLEN 255
|
||||
char d_name[MAXNAMLEN + 1]; /*!< zero-terminated file name */
|
||||
#else
|
||||
char d_name[256];
|
||||
#endif
|
||||
};
|
||||
|
||||
DIR* opendir(const char* name);
|
||||
struct dirent* readdir(DIR* pdir);
|
||||
long telldir(DIR* pdir);
|
||||
void seekdir(DIR* pdir, long loc);
|
||||
void rewinddir(DIR* pdir);
|
||||
int closedir(DIR* pdir);
|
||||
int readdir_r(DIR* pdir, struct dirent* entry, struct dirent** out_dirent);
|
||||
int scandir(const char *dirname, struct dirent ***out_dirlist,
|
||||
int (*select_func)(const struct dirent *),
|
||||
int (*cmp_func)(const struct dirent **, const struct dirent **));
|
||||
int alphasort(const struct dirent **d1, const struct dirent **d2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else // __clang__ TODO: IDF-10675
|
||||
#include_next <sys/dirent.h>
|
||||
#include <dirent.h>
|
||||
#endif // __clang__
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -12,7 +12,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _RETARGETABLE_LOCKING
|
||||
#if defined(_RETARGETABLE_LOCKING) || defined(CONFIG_LIBC_PICOLIBC)
|
||||
|
||||
/* Actual platfrom-specific definition of struct __lock.
|
||||
* The size here should be sufficient for a FreeRTOS mutex.
|
||||
@@ -52,10 +52,6 @@ int _lock_try_acquire_recursive(_lock_t *plock);
|
||||
void _lock_release(_lock_t *plock);
|
||||
void _lock_release_recursive(_lock_t *plock);
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
#define __lock_try_acquire(lock) _lock_try_acquire(&(lock))
|
||||
#define __lock_try_acquire_recursive(lock) _lock_try_acquire_recursive(&(lock))
|
||||
#endif // CONFIG_LIBC_PICOLIBC
|
||||
#endif // _RETARGETABLE_LOCKING
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -26,6 +26,10 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct
|
||||
|
||||
#endif // fd_set
|
||||
|
||||
#if __BSD_VISIBLE && !defined(fds_bits)
|
||||
#define fds_bits __fds_bits
|
||||
#endif
|
||||
|
||||
#if defined(FD_ISSET) || defined(FD_SET) || defined(FD_CLR)
|
||||
#undef FD_SET
|
||||
#undef FD_CLR
|
||||
|
||||
Reference in New Issue
Block a user