blob: c10bcbf693747df5ff7c9e7fa1e7ffdb1001858c [file] [log] [blame]
Khem Raj0eeb9cd2018-08-06 15:57:00 -07001update for glibc libio.h removal in 2.28+
2
3see
4https://src.fedoraproject.org/rpms/m4/c/814d592134fad36df757f9a61422d164ea2c6c9b?branch=master
5
Brad Bishopc342db32019-05-15 21:57:59 -04006Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a718]
Khem Raj0eeb9cd2018-08-06 15:57:00 -07007Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishopc342db32019-05-15 21:57:59 -04008
Khem Raj0eeb9cd2018-08-06 15:57:00 -07009Index: m4-1.4.18/lib/fflush.c
10===================================================================
11--- m4-1.4.18.orig/lib/fflush.c
12+++ m4-1.4.18/lib/fflush.c
13@@ -33,7 +33,7 @@
14 #undef fflush
15
16
17-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
18+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
19
20 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
21 static void
22@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
23
24 #endif
25
26-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
27+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
28
29 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
30 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
31@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
32 if (stream == NULL || ! freading (stream))
33 return fflush (stream);
34
35-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
36+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
37
38 clear_ungetc_buffer_preserving_position (stream);
39
40Index: m4-1.4.18/lib/fpending.c
41===================================================================
42--- m4-1.4.18.orig/lib/fpending.c
43+++ m4-1.4.18/lib/fpending.c
44@@ -32,7 +32,7 @@ __fpending (FILE *fp)
45 /* Most systems provide FILE as a struct and the necessary bitmask in
46 <stdio.h>, because they need it for implementing getc() and putc() as
47 fast macros. */
48-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
49+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
50 return fp->_IO_write_ptr - fp->_IO_write_base;
51 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
52 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
53Index: m4-1.4.18/lib/fpurge.c
54===================================================================
55--- m4-1.4.18.orig/lib/fpurge.c
56+++ m4-1.4.18/lib/fpurge.c
57@@ -62,7 +62,7 @@ fpurge (FILE *fp)
58 /* Most systems provide FILE as a struct and the necessary bitmask in
59 <stdio.h>, because they need it for implementing getc() and putc() as
60 fast macros. */
61-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
62+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
63 fp->_IO_read_end = fp->_IO_read_ptr;
64 fp->_IO_write_ptr = fp->_IO_write_base;
65 /* Avoid memory leak when there is an active ungetc buffer. */
66Index: m4-1.4.18/lib/freadahead.c
67===================================================================
68--- m4-1.4.18.orig/lib/freadahead.c
69+++ m4-1.4.18/lib/freadahead.c
70@@ -25,7 +25,7 @@
71 size_t
72 freadahead (FILE *fp)
73 {
74-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
75+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
76 if (fp->_IO_write_ptr > fp->_IO_write_base)
77 return 0;
78 return (fp->_IO_read_end - fp->_IO_read_ptr)
79Index: m4-1.4.18/lib/freading.c
80===================================================================
81--- m4-1.4.18.orig/lib/freading.c
82+++ m4-1.4.18/lib/freading.c
83@@ -31,7 +31,7 @@ freading (FILE *fp)
84 /* Most systems provide FILE as a struct and the necessary bitmask in
85 <stdio.h>, because they need it for implementing getc() and putc() as
86 fast macros. */
87-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
88+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
89 return ((fp->_flags & _IO_NO_WRITES) != 0
90 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
91 && fp->_IO_read_base != NULL));
92Index: m4-1.4.18/lib/fseeko.c
93===================================================================
94--- m4-1.4.18.orig/lib/fseeko.c
95+++ m4-1.4.18/lib/fseeko.c
96@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
97 #endif
98
99 /* These tests are based on fpurge.c. */
100-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
101+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
102 if (fp->_IO_read_end == fp->_IO_read_ptr
103 && fp->_IO_write_ptr == fp->_IO_write_base
104 && fp->_IO_save_base == NULL)
105@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
106 return -1;
107 }
108
109-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
110+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
111 fp->_flags &= ~_IO_EOF_SEEN;
112 fp->_offset = pos;
113 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
114Index: m4-1.4.18/lib/stdio-impl.h
115===================================================================
116--- m4-1.4.18.orig/lib/stdio-impl.h
117+++ m4-1.4.18/lib/stdio-impl.h
118@@ -18,6 +18,12 @@
119 the same implementation of stdio extension API, except that some fields
120 have different naming conventions, or their access requires some casts. */
121
122+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
123+ problem by defining it ourselves. FIXME: Do not rely on glibc
124+ internals. */
125+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
126+# define _IO_IN_BACKUP 0x100
127+#endif
128
129 /* BSD stdio derived implementations. */
130