Browse Source

[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 <920369182@qq.com>
FragrantRye 1 năm trước cách đây
mục cha
commit
2917180c21
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      components/libc/posix/io/stdio/stdio.c

+ 5 - 1
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)