summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFragrantRye <[email protected]>2023-08-16 19:47:41 -0400
committerMeco Man <[email protected]>2023-08-17 02:22:53 -0400
commit2917180c216cf31c44bfad7a069cac6ba54ed9aa (patch)
treeeb02d2de6cdfc5055124bd874da7664954d88186
parentb08d8672d258b029edc4d2c45543c3af9e595830 (diff)
[libc][newlib] __sdidinit is obselete
related: https://github.com/RT-Thread/rt-thread/issues/7923 https://github.com/mirror/newlib-cygwin/commit/44b60f0c4ba597c55dcac4f2d3119a3055c80ba1 Co-authored-by: Meco Man <[email protected]>
-rw-r--r--components/libc/posix/io/stdio/stdio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/libc/posix/io/stdio/stdio.c b/components/libc/posix/io/stdio/stdio.c
index 4e5464c53a..98816c1f28 100644
--- a/components/libc/posix/io/stdio/stdio.c
+++ b/components/libc/posix/io/stdio/stdio.c
@@ -47,6 +47,8 @@ INIT_ENV_EXPORT(rt_posix_stdio_init);
#if defined(RT_USING_NEWLIBC)
+#define NEWLIB_VERSION_NUM (__NEWLIB__ * 10000U + __NEWLIB_MINOR__ * 100U + __NEWLIB_PATCHLEVEL__)
+
static FILE* std_console = NULL;
int rt_posix_stdio_set_console(const char* device_name, int mode)
{
@@ -102,7 +104,9 @@ int rt_posix_stdio_set_console(const char* device_name, int mode)
_GLOBAL_REENT->_stderr = std_console;
}
- _GLOBAL_REENT->__sdidinit = 1;
+#if (NEWLIB_VERSION_NUM < 30400U) || (NEWLIB_VERSION_NUM >= 40000U && NEWLIB_VERSION_NUM < 40300U)
+ _GLOBAL_REENT->__sdidinit = 1; /* __sdidinit is obselete */
+#endif
}
if (std_console)