[PATCHSET,4/4] Fix various issue in TUI

Message ID 83vbkrbt4d.fsf@gnu.org
State New, archived
Headers

Commit Message

Eli Zaretskii Dec. 31, 2014, 5:56 p.m. UTC
  Well, one patch is Windows-specific after all.  This patch makes sure
windows-termcap is not compiled when GDB is linked against ncurses,
and also makes the file a no-op should it compile in that
configuration.  This is to avoid shadowing of ncurses functions by the
stubs in windows-termcap.c.

OK to commit?

2014-12-31  Eli Zaretskii  <eliz@gnu.org>

	* gdb/configure.ac [mingw32]: Don't add windows-termcap.o to
	CONFIG_OBJS if a curses library is going to be used.

	* gdb/windows-termcap.c: Make the entire file a no-op if any
	kind of curses library i being used.
  

Comments

Pedro Alves Jan. 5, 2015, 7:54 p.m. UTC | #1
On 12/31/2014 05:56 PM, Eli Zaretskii wrote:
> Well, one patch is Windows-specific after all.  This patch makes sure
> windows-termcap is not compiled when GDB is linked against ncurses,

...

> and also makes the file a no-op should it compile in that
> configuration.  

With the configure.ac change, how can that happen?

> This is to avoid shadowing of ncurses functions by the
> stubs in windows-termcap.c.
> 
> OK to commit?
> 
> 2014-12-31  Eli Zaretskii  <eliz@gnu.org>
> 
> 	* gdb/configure.ac [mingw32]: Don't add windows-termcap.o to
> 	CONFIG_OBJS if a curses library is going to be used.

No "gdb/" prefix.

> 
> 	* gdb/windows-termcap.c: Make the entire file a no-op if any
> 	kind of curses library i being used.

typo: "is".

> 
> 
> --- gdb/configure.ac~0	2014-10-29 21:45:50 +0200
> +++ gdb/configure.ac	2014-12-30 07:42:27 +0200
> @@ -627,9 +627,10 @@
>      ac_cv_search_tgetent="none required"
>      ;;
>    *mingw32*)
> -    ac_cv_search_tgetent="none required"
> -    CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
> -    ;;
> +    if test x"$prefer_curses" = xyes; then
> +      ac_cv_search_tgetent="none required"
> +      CONFIG_OBS="$CONFIG_OBS windows-termcap.o"

I'm confused on the predicate here.  How can we tell
from $prefer_curses that the curses library doesn't include
termcap?  AFAICS, if the TUI is enabled, it'll always be
"yes".  But isn't that the case where you _don't_
want windows-termcap.o?  And shouldn't this be checking
$curses_found?

> +    fi ;;
>  esac
>  
>  # These are the libraries checked by Readline.
> 
> 
> --- gdb/windows-termcap.c~0	2014-06-11 18:34:41 +0300
> +++ gdb/windows-termcap.c	2014-12-29 15:42:44 +0200
> @@ -19,6 +19,11 @@
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> +
> +#include "config.h"

All files in gdb/ should start with "defs.h" instead.

Thanks,
Pedro Alves
  
Eli Zaretskii Jan. 5, 2015, 8:06 p.m. UTC | #2
> Date: Mon, 05 Jan 2015 19:54:42 +0000
> From: Pedro Alves <palves@redhat.com>
> 
> On 12/31/2014 05:56 PM, Eli Zaretskii wrote:
> > Well, one patch is Windows-specific after all.  This patch makes sure
> > windows-termcap is not compiled when GDB is linked against ncurses,
> 
> ...
> 
> > and also makes the file a no-op should it compile in that
> > configuration.  
> 
> With the configure.ac change, how can that happen?

It shouldn't.

> > --- gdb/configure.ac~0	2014-10-29 21:45:50 +0200
> > +++ gdb/configure.ac	2014-12-30 07:42:27 +0200
> > @@ -627,9 +627,10 @@
> >      ac_cv_search_tgetent="none required"
> >      ;;
> >    *mingw32*)
> > -    ac_cv_search_tgetent="none required"
> > -    CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
> > -    ;;
> > +    if test x"$prefer_curses" = xyes; then
> > +      ac_cv_search_tgetent="none required"
> > +      CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
> 
> I'm confused on the predicate here.  How can we tell
> from $prefer_curses that the curses library doesn't include
> termcap?  AFAICS, if the TUI is enabled, it'll always be
> "yes".  But isn't that the case where you _don't_
> want windows-termcap.o?  And shouldn't this be checking
> $curses_found?

Sorry, I sent the wrong patch here.  It should be !=, of course.

> > --- gdb/windows-termcap.c~0	2014-06-11 18:34:41 +0300
> > +++ gdb/windows-termcap.c	2014-12-29 15:42:44 +0200
> > @@ -19,6 +19,11 @@
> >     You should have received a copy of the GNU General Public License
> >     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> >  
> > +
> > +#include "config.h"
> 
> All files in gdb/ should start with "defs.h" instead.

OK.

Thanks.
  

Patch

--- gdb/configure.ac~0	2014-10-29 21:45:50 +0200
+++ gdb/configure.ac	2014-12-30 07:42:27 +0200
@@ -627,9 +627,10 @@ 
     ac_cv_search_tgetent="none required"
     ;;
   *mingw32*)
-    ac_cv_search_tgetent="none required"
-    CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
-    ;;
+    if test x"$prefer_curses" = xyes; then
+      ac_cv_search_tgetent="none required"
+      CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
+    fi ;;
 esac
 
 # These are the libraries checked by Readline.


--- gdb/windows-termcap.c~0	2014-06-11 18:34:41 +0300
+++ gdb/windows-termcap.c	2014-12-29 15:42:44 +0200
@@ -19,6 +19,11 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+
+#include "config.h"
+
+#if !defined HAVE_CURSES_H && !defined HAVE_NCURSES_H && !defined HAVE_NCURSES_NCURSES_H
+
 #include <stdlib.h>
 
 /* -Wmissing-prototypes */
@@ -71,3 +76,5 @@ 
 {
   return NULL;
 }
+
+#endif	/* !HAVE_CURSES_H && !HAVE_NCURSES_H && !HAVE_NCURSES_NCURSES_H */