Patchwork [8/8] Require readline 7 or newer

login
register
mail settings
Submitter Tom Tromey
Date Aug. 6, 2019, 8:43 p.m.
Message ID <20190806204334.13441-9-tom@tromey.com>
Download mbox | patch
Permalink /patch/33984/
State New
Headers show

Comments

Tom Tromey - Aug. 6, 2019, 8:43 p.m.
This changes gdb to require readline 7 or newer at build time.

2019-04-21  Tom Tromey  <tom@tromey.com>

	* README: Update.
	* event-top.c: Require readline 7.

gdb/doc/ChangeLog
2019-04-21  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Configure Options): Document minimum version of
	readline.
---
 gdb/ChangeLog       | 5 +++++
 gdb/README          | 3 ++-
 gdb/doc/ChangeLog   | 5 +++++
 gdb/doc/gdb.texinfo | 3 ++-
 gdb/event-top.c     | 3 +++
 5 files changed, 17 insertions(+), 2 deletions(-)
Eli Zaretskii - Aug. 7, 2019, 2:27 a.m.
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>
> Date: Tue,  6 Aug 2019 14:43:34 -0600
> 
> This changes gdb to require readline 7 or newer at build time.
> 
> 2019-04-21  Tom Tromey  <tom@tromey.com>
> 
> 	* README: Update.
> 	* event-top.c: Require readline 7.
> 
> gdb/doc/ChangeLog
> 2019-04-21  Tom Tromey  <tom@tromey.com>
> 
> 	* gdb.texinfo (Configure Options): Document minimum version of
> 	readline.

The documentation parts are OK, thanks.
Pedro Alves - Aug. 7, 2019, 2:42 p.m.
On 8/6/19 9:43 PM, Tom Tromey wrote:

>  @item --with-system-readline
>  Use the readline library installed on the host, rather than the
> -library supplied as part of @value{GDBN}.
> +library supplied as part of @value{GDBN}.  Readline 7 or newer is
> +required; this is enforced by the build system.
>  

> --- a/gdb/event-top.c
> +++ b/gdb/event-top.c
> @@ -48,6 +48,9 @@
>  /* readline defines this.  */
>  #undef savestring
>  
> +/* gdb requires readline 7 now.  */
> +gdb_static_assert (RL_VERSION_MAJOR >= 7);
> +

I'd be much better user experience if this were done at by the
build system, at configure time, with AC_TRY_COMPILE, IMO.  Something
similar to the "GNU regex" check should do it.

As is, it's plausible that the build would error out failing to compile
some other .c file that happened to use some readline symbol/struct/function/etc.
that only exists in the supported readline.  Alternatively, we could have
some gdb_readline.h wrapper header and do the check there, though a configure
check seems natural to me and should be simple.

Thanks,
Pedro Alves
Pedro Alves - Aug. 7, 2019, 2:45 p.m.
On 8/6/19 9:43 PM, Tom Tromey wrote:
> This changes gdb to require readline 7 or newer at build time.
> 
> 2019-04-21  Tom Tromey  <tom@tromey.com>
> 
> 	* README: Update.
> 	* event-top.c: Require readline 7.
> 
> gdb/doc/ChangeLog
> 2019-04-21  Tom Tromey  <tom@tromey.com>
> 
> 	* gdb.texinfo (Configure Options): Document minimum version of
> 	readline.

This should be mentioned in gdb/NEWS too, IMO.

Thanks,
Pedro Alves

Patch

diff --git a/gdb/README b/gdb/README
index 8a91aab2a4c..8883a8a09e3 100644
--- a/gdb/README
+++ b/gdb/README
@@ -439,7 +439,8 @@  more obscure GDB `configure' options are not listed here.
 
 `--with-system-readline'
      Use the readline library installed on the host, rather than the
-     library supplied as part of GDB.
+     library supplied as part of GDB.  Readline 7 or newer is required;
+     this is enforced by the build system.
 
 `--with-system-zlib
      Use the zlib library installed on the host, rather than the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 89b1eda2c17..e384718fc11 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -36897,7 +36897,8 @@  details.
 
 @item --with-system-readline
 Use the readline library installed on the host, rather than the
-library supplied as part of @value{GDBN}.
+library supplied as part of @value{GDBN}.  Readline 7 or newer is
+required; this is enforced by the build system.
 
 @item --with-system-zlib
 Use the zlib library installed on the host, rather than the library
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 2132fb550dc..07cedc42584 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -48,6 +48,9 @@ 
 /* readline defines this.  */
 #undef savestring
 
+/* gdb requires readline 7 now.  */
+gdb_static_assert (RL_VERSION_MAJOR >= 7);
+
 static std::string top_level_prompt ();
 
 /* Signal handlers.  */