[PATCH 4/7] Optional struct _reent::_unspecified_locale_info

Sebastian Huber sebastian.huber@embedded-brains.de
Fri May 13 13:46:57 GMT 2022


Provide struct _reent::_unspecified_locale_info only if
_NEWLIB_BACKWARD_BINARY_COMPAT is defined.
---
 newlib/libc/include/sys/reent.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 6a1340b4f..96fa94bd7 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -343,8 +343,10 @@ struct _rand48 {
 #define _REENT_SIGNAL_SIZE 24
 
 #ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
+#define _REENT_INIT_UNUSED_LOCALE_INFO 0,
 #define _REENT_INIT_UNUSED_SDIDINIT 0,
 #else
+#define _REENT_INIT_UNUSED_LOCALE_INFO /* Nothing to initialize */
 #define _REENT_INIT_UNUSED_SDIDINIT /* Nothing to initialize */
 #endif
 
@@ -405,9 +407,9 @@ struct _reent
   /* No longer used, but member retained for binary compatibility.
      Now, the __cleanup member is used to check initialization. */
   int _unused_sdidinit;
-#endif
 
   int _unspecified_locale_info;	/* unused, reserved for locale stuff */
+#endif
   struct __locale_t *_locale;/* per-thread locale */
 
   struct _mprec *_mp;
@@ -449,7 +451,7 @@ struct _reent
     0,   \
     _NULL, \
     _REENT_INIT_UNUSED_SDIDINIT \
-    0, \
+    _REENT_INIT_UNUSED_LOCALE_INFO \
     _NULL, \
     _NULL, \
     _NULL, \
@@ -487,7 +489,7 @@ extern const struct __sFILE_fake __sf_fake_stderr;
     0, \
     _NULL, \
     _REENT_INIT_UNUSED_SDIDINIT \
-    0, \
+    _REENT_INIT_UNUSED_LOCALE_INFO \
     _NULL, \
     _NULL, \
     _NULL, \
@@ -638,7 +640,9 @@ struct _reent
   char _emergency[_REENT_EMERGENCY_SIZE];
 
   /* TODO */
+#ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
   int _unspecified_locale_info;	/* unused, reserved for locale stuff */
+#endif
   struct __locale_t *_locale;/* per-thread locale */
 
 #ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
@@ -731,7 +735,7 @@ struct _reent
     _REENT_STDIO_STREAM(&(var), 2), \
     0, \
     "", \
-    0, \
+    _REENT_INIT_UNUSED_LOCALE_INFO \
     _NULL, \
     _REENT_INIT_UNUSED_SDIDINIT \
     _NULL, \
-- 
2.35.3



More information about the Newlib mailing list