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