]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t.
authorZack Weinberg <zackw@panix.com>
Sun, 10 Mar 2019 02:18:56 +0000 (21:18 -0500)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 17:56:33 +0000 (12:56 -0500)
The declarations of ldiv_t, lldiv_t, and __gwchar_t are all wrapped in
__foo_t_defined conditionals, despite there being only one header in
glibc that declares them.  I checked codesearch.debian.net and only
found one other program that refers to the __foo_t_defined
conditionals: u-boot provides its own definition of ldiv_t if
__ldiv_t_defined is not defined by stdlib.h.  I conclude that the
conditionals are not necessary, but the definitions of
__ldiv_t_defined and __lldiv_t_defined should be preserved.

* stdlib/inttypes.h: Unconditionally define __gwchar_t.
        Don’t define ____gwchar_t_defined.
        * stdlib/stdlib.h: Unconditionally define ldiv_t.
        Condition lldiv_t only on __USE_ISOC99.

stdlib/inttypes.h
stdlib/stdlib.h

index 685dfc136076f5c27587fbaa61f18c6a3ada2f38..c5ec307c5c63fbf10fdc8ae9ff88c98a3e762ffe 100644 (file)
 #include <stdint.h>
 
 /* Get a definition for wchar_t.  But we must not define wchar_t itself.  */
-#ifndef ____gwchar_t_defined
-# ifdef __cplusplus
-#  define __gwchar_t wchar_t
-# elif defined __WCHAR_TYPE__
+#ifdef __cplusplus
+# define __gwchar_t wchar_t
+#elif defined __WCHAR_TYPE__
 typedef __WCHAR_TYPE__ __gwchar_t;
-# else
-#  define __need_wchar_t
-#  include <stddef.h>
+#else
+# define __need_wchar_t
+# include <stddef.h>
 typedef wchar_t __gwchar_t;
-# endif
-# define ____gwchar_t_defined  1
 #endif
 
 # if __WORDSIZE == 64
index e3470631e18355a153bb082b50d5b334c2ee70c3..9f1f1b80e3dfaf892dc50a9cdfa068fc2312dbd2 100644 (file)
@@ -62,16 +62,14 @@ typedef struct
   } div_t;
 
 /* Returned by `ldiv'.  */
-#ifndef __ldiv_t_defined
 typedef struct
   {
     long int quot;             /* Quotient.  */
     long int rem;              /* Remainder.  */
   } ldiv_t;
-# define __ldiv_t_defined      1
-#endif
+#define __ldiv_t_defined       1
 
-#if defined __USE_ISOC99 && !defined __lldiv_t_defined
+#if defined __USE_ISOC99
 /* Returned by `lldiv'.  */
 __extension__ typedef struct
   {