[PATCH 3/7] Optional struct _reent::__unused_sdidinit

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


Provide struct _reent::__unused_sdidinit only if _NEWLIB_BACKWARD_BINARY_COMPAT
is defined.
---
 newlib/libc/include/sys/reent.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index fa9ac57da..6a1340b4f 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -342,6 +342,12 @@ struct _rand48 {
 #define _REENT_ASCTIME_SIZE 26
 #define _REENT_SIGNAL_SIZE 24
 
+#ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
+#define _REENT_INIT_UNUSED_SDIDINIT 0,
+#else
+#define _REENT_INIT_UNUSED_SDIDINIT /* Nothing to initialize */
+#endif
+
 /*
  * struct _reent
  *
@@ -395,9 +401,11 @@ struct _reent
 
   char *_emergency;
 
+#ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
   /* 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 */
   struct __locale_t *_locale;/* per-thread locale */
@@ -440,7 +448,7 @@ struct _reent
     &__sf[2], \
     0,   \
     _NULL, \
-    0, \
+    _REENT_INIT_UNUSED_SDIDINIT \
     0, \
     _NULL, \
     _NULL, \
@@ -478,7 +486,7 @@ extern const struct __sFILE_fake __sf_fake_stderr;
     (__FILE *)&__sf_fake_stderr, \
     0, \
     _NULL, \
-    0, \
+    _REENT_INIT_UNUSED_SDIDINIT \
     0, \
     _NULL, \
     _NULL, \
@@ -633,9 +641,11 @@ struct _reent
   int _unspecified_locale_info;	/* unused, reserved for locale stuff */
   struct __locale_t *_locale;/* per-thread locale */
 
+#ifdef _NEWLIB_BACKWARD_BINARY_COMPAT
   /* No longer used, but member retained for binary compatibility.
      Now, the __cleanup member is used to check initialization. */
   int _unused_sdidinit;
+#endif
 
   void (*__cleanup) (struct _reent *);
 
@@ -723,7 +733,7 @@ struct _reent
     "", \
     0, \
     _NULL, \
-    0, \
+    _REENT_INIT_UNUSED_SDIDINIT \
     _NULL, \
     _NULL, \
     0, \
-- 
2.35.3



More information about the Newlib mailing list