mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-25 21:03:54 +00:00
fix(esp_libc): picolibc: make funopen() declaration compatible with newlib
This commit is contained in:
@@ -4,16 +4,39 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
|
||||
#include <stddef.h>
|
||||
#include <sys/features.h>
|
||||
/* Undefine __BSD_VISIBLE to set proper funopen declaration */
|
||||
#pragma push_macro("__BSD_VISIBLE")
|
||||
#undef __BSD_VISIBLE
|
||||
#endif
|
||||
|
||||
#include_next <stdio.h>
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
|
||||
#pragma pop_macro("__BSD_VISIBLE")
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
|
||||
#include <stddef.h>
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
FILE *funopen(const void *cookie,
|
||||
int (*readfn)(void *cookie, char *buf,
|
||||
int n),
|
||||
int (*writefn)(void *cookie, const char *buf,
|
||||
int n),
|
||||
__off_t (*seekfn)(void *cookie, __off_t off, int whence),
|
||||
int (*closefn)(void *cookie));
|
||||
# define fropen(__cookie, __fn) funopen(__cookie, __fn, NULL, NULL, NULL)
|
||||
# define fwopen(__cookie, __fn) funopen(__cookie, NULL, __fn, NULL, NULL)
|
||||
#endif /*__BSD_VISIBLE */
|
||||
|
||||
void flockfile(FILE *);
|
||||
void funlockfile(FILE *);
|
||||
FILE *open_memstream(char **, size_t *);
|
||||
|
||||
Reference in New Issue
Block a user