From 4c9b5f35346387d9a1bd538f79f982d0b8e79821 Mon Sep 17 00:00:00 2001 From: paolodeidda Date: Mon, 13 Oct 2025 10:47:58 +0200 Subject: [PATCH 1/3] Fix macOS fdopen redefinition --- zlib/zutil.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zlib/zutil.h b/zlib/zutil.h index 1b6fbb8a86..9884615e52 100644 --- a/zlib/zutil.h +++ b/zlib/zutil.h @@ -21,6 +21,12 @@ #include "zlib.h" +/* Fix for macOS: prevent fdopen redefinition conflicts */ +#ifdef fdopen +#undef fdopen +#endif +#define fdopen(fd,mode) fdopen(fd,mode) + #if defined(STDC) && !defined(Z_SOLO) # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) # include @@ -119,18 +125,24 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 +# define OS_CODE 0x07 + # ifndef Z_SOLO # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifdef fdopen +# undef fdopen +# endif +# define fdopen(fd, mode) NULL /* No fdopen() */ # endif # endif # endif + #endif + #ifdef TOPS20 # define OS_CODE 0x0a #endif From 4531dcc16a58845f82a39421ba46efb1ced079e0 Mon Sep 17 00:00:00 2001 From: paolodeidda Date: Mon, 13 Oct 2025 12:29:43 +0200 Subject: [PATCH 2/3] Fix macOS build (ECHOCTL guard + C23 compatibility warnings) --- readline/rltty.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/readline/rltty.c b/readline/rltty.c index d237b1c004..4f026b62d1 100644 --- a/readline/rltty.c +++ b/readline/rltty.c @@ -238,9 +238,12 @@ prepare_terminal_settings (meta_flag, oldtio, tiop) TIOTYPE oldtio, *tiop; { _rl_echoing_p = (oldtio.sgttyb.sg_flags & ECHO); - _rl_echoctl = (oldtio.sgttyb.sg_flags & ECHOCTL); - - /* Copy the original settings to the structure we're going to use for +#if defined(ECHOCTL) + _rl_echoctl = (oldtio.c_lflag & ECHOCTL); +#else + _rl_echoctl = 0; /* macOS or systems without ECHOCTL */ +#endif + /* Copy the original settings to the structure we're going to use for our settings. */ tiop->sgttyb = oldtio.sgttyb; tiop->lflag = oldtio.lflag; From d07ad8c11d70008c6957f3a93f5ce86b71404ec4 Mon Sep 17 00:00:00 2001 From: paolodeidda Date: Mon, 13 Oct 2025 14:08:12 +0200 Subject: [PATCH 3/3] Update submodules to include macOS-compatible fixes --- gdb/common/enum-flags.h | 12 ++++++++++++ readline/rltty.c | 4 +--- readline/terminal.c | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gdb/common/enum-flags.h b/gdb/common/enum-flags.h index 9b8c952df8..d4e83716f1 100644 --- a/gdb/common/enum-flags.h +++ b/gdb/common/enum-flags.h @@ -51,6 +51,10 @@ #ifdef __cplusplus +#if __cplusplus >= 201103L +#include +#endif + /* Traits type used to prevent the global operator overloads from instantiating for non-flag enums. */ template struct enum_flags_type {}; @@ -66,6 +70,7 @@ template struct enum_flags_type {}; typedef enum_flags type; \ } +#if __cplusplus < 201103L /* Until we can rely on std::underlying type being universally available (C++11), roll our own for enums. */ template class integer_for_size { typedef void type; }; @@ -85,6 +90,13 @@ struct enum_underlying_type integer_for_size(T (-1) < T (0))>::type type; }; +#else +template +struct enum_underlying_type +{ + typedef typename std::underlying_type::type type; +}; +#endif template class enum_flags diff --git a/readline/rltty.c b/readline/rltty.c index 4f026b62d1..937ceef12d 100644 --- a/readline/rltty.c +++ b/readline/rltty.c @@ -37,9 +37,7 @@ #include "rldefs.h" -#if defined (GWINSZ_IN_SYS_IOCTL) -# include -#endif /* GWINSZ_IN_SYS_IOCTL */ +#include #include "rltty.h" #include "readline.h" diff --git a/readline/terminal.c b/readline/terminal.c index 8094186bba..62aa1e0c48 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -47,6 +47,7 @@ #endif #include +#include /* System-specific feature definitions and include files. */ #include "rldefs.h"