From 27dae84ed92f1ef0300263091972338d12e78348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 18 Oct 2025 19:06:52 +0200 Subject: New upstream version 1.4.1 --- lib/stdio-impl.h | 76 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 14 deletions(-) (limited to 'lib/stdio-impl.h') diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 63ebf7c6..4abf9e68 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -1,5 +1,5 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -30,6 +30,49 @@ # endif #endif +/* Haiku stdio implementation. */ +#if defined __HAIKU__ +# include +/* This FILE structure was made into an incomplete type in 2025. + See . */ +# define fp_ ((struct { int _flags; \ + char *_IO_read_ptr; \ + char *_IO_read_end; \ + char *_IO_read_base; \ + char *_IO_write_base; \ + char *_IO_write_ptr; \ + char *_IO_write_end; \ + char *_IO_buf_base; \ + char *_IO_buf_end; \ + char *_IO_save_base; \ + char *_IO_backup_base; \ + char *_IO_save_end; \ + void *_markers; \ + void *_chain; \ + int _fileno; \ + int _flags2; \ + off_t _old_offset; \ + unsigned short _cur_column; \ + signed char _vtable_offset; \ + char _shortbuf[1]; \ + void *_lock; \ + int64_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) +# if !defined _IO_UNBUFFERED +# define _IO_UNBUFFERED 0x2 +# endif +# if !defined _IO_EOF_SEEN +# define _IO_EOF_SEEN 0x10 +# endif +# if !defined _IO_IN_BACKUP +# define _IO_IN_BACKUP 0x100 +# endif +# if !defined _IO_LINE_BUF +# define _IO_LINE_BUF 0x200 +# endif +#endif + /* BSD stdio derived implementations. */ #if defined __NetBSD__ /* NetBSD */ @@ -39,7 +82,7 @@ #include /* For detecting Plan9. */ -#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ +#if defined __sferror || defined __OpenBSD__ || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ @@ -65,13 +108,15 @@ # define _flags pub._flags # define _r pub._r # define _w pub._w -# elif defined __ANDROID__ /* Android */ -# ifdef __LP64__ +# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ +# if defined __LP64__ && !defined __OpenBSD__ # define _gl_flags_file_t int # else # define _gl_flags_file_t short # endif -# ifdef __LP64__ +# if defined __OpenBSD__ +# define _gl_file_offset_t fpos_t +# elif defined __LP64__ # define _gl_file_offset_t int64_t # else /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ @@ -79,10 +124,12 @@ # endif /* Up to this commit from 2015-10-12 - the innards of FILE were public, and fp_ub could be defined like for OpenBSD, + the innards of FILE were public, see and . - After this commit, the innards of FILE are hidden. */ + After this commit, the innards of FILE are hidden. Likewise for OpenBSD + up to this commit from 2025-07-16 + . */ # define fp_ ((struct { unsigned char *_p; \ int _r; \ int _w; \ @@ -109,9 +156,8 @@ # define fp_ fp # endif -# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */ - /* See - and +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __minix /* NetBSD >= 1.5ZA, Minix 3 */ + /* See and */ struct __sfileext { @@ -119,7 +165,7 @@ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub -# elif defined __ANDROID__ /* Android */ +# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ struct __sfileext { struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */ @@ -132,9 +178,11 @@ # define HASUB(fp) (fp_ub._base != NULL) -# if defined __ANDROID__ /* Android */ - /* Needed after this commit from 2016-01-25 - */ +# if defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ + /* Needed after this Android commit from 2016-01-25 + + And after this OpenBSD commit from 2025-07-16 + . */ # ifndef __SEOF # define __SLBF 1 # define __SNBF 2 -- cgit v1.2.3