From 36039c8526eb6cec6e59aae9db22765543ba0be9 Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 12 Oct 2022 15:05:11 +0800 Subject: [PATCH] newlib/impure: declare thread specific file only if __NEWLIB__ is defined. Signed-off-by: chao an --- libs/libc/misc/lib_impure.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/libc/misc/lib_impure.c b/libs/libc/misc/lib_impure.c index 4fbdec066d..a6e12ce7f7 100644 --- a/libs/libc/misc/lib_impure.c +++ b/libs/libc/misc/lib_impure.c @@ -44,14 +44,16 @@ * Public Functions ****************************************************************************/ -#if defined(_REENT_SMALL) && \ - (defined(__NEWLIB__) || __NEWLIB__ < 4 || \ - __NEWLIB__ == 4 && __NEWLIB_MINOR__ < 2) +#ifdef __NEWLIB__ +# if (__NEWLIB__ < 4 || __NEWLIB__ == 4 && __NEWLIB_MINOR__ < 2) +# ifdef _REENT_SMALL extern struct __sFILE_fake __sf_fake_stdin _ATTRIBUTE((weak)); extern struct __sFILE_fake __sf_fake_stdout _ATTRIBUTE((weak)); extern struct __sFILE_fake __sf_fake_stderr _ATTRIBUTE((weak)); -#else +# endif +# else extern __FILE __sf[3] _ATTRIBUTE((weak)); +# endif #endif static struct _reent __ATTRIBUTE_IMPURE_DATA__