This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix tui compilation with Solaris libcurses: clear define (PR tui/21482)


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6e7e1744e96abbf1a4229d5f269caf2cc921ec58

commit 6e7e1744e96abbf1a4229d5f269caf2cc921ec58
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Fri May 19 15:08:45 2017 +0200

    Fix tui compilation with Solaris libcurses: clear define (PR tui/21482)
    
    On both mainline and the 8.0 branch, gdb compilation fails on Solaris 10
    with the native libcurses like this:
    
    In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curses.h:42:
    0,
                     from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-data.h:2
    6,
                     from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c
    :31:
    /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c: In function `CORE_A
    DDR tui_disassemble(gdbarch*, tui_asm_line*, CORE_ADDR, int)':
    /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:71:19: error: `class
     string_file' has no member named `wclear'; did you mean `clear'?
           gdb_dis_out.clear ();
                       ^
    /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:78:19: error: `class
     string_file' has no member named `wclear'; did you mean `clear'?
           gdb_dis_out.clear ();
                       ^
    make[2]: *** [Makefile:1927: tui-disasm.o] Error 1
    
    It turned out this happens because <curses.h> has
    
    #define clear()         wclear(stdscr)
    
    This can be avoided by defining NOMACROS, which the patch below does.
    ncurses potentially has a similar problem, which can be avoided by defining
    NCURSES_NOMACROS.
    
    	PR tui/21482
    	* gdb_curses.h (NOMACROS): Define.
    	(NCURSES_NOMACROS): Define.

Diff:
---
 gdb/ChangeLog    | 7 +++++++
 gdb/gdb_curses.h | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6bffa90..59fa951 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2017-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
+	PR tui/21482
+	* gdb_curses.h (NOMACROS): Define.
+	(NCURSES_NOMACROS): Define.
+
+2017-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	PR tui/21482
 	* tui/tui-windata.c (tui_erase_data_content): Cast last mvwaddstr
 	arg to char *.
 	* tui/tui-wingeneral.c (box_win): Likewise.
diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index 16442c7..72fafe3 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -32,6 +32,13 @@
 #undef KEY_EVENT
 #endif
 
+/* On Solaris and probably other SysVr4 derived systems, we need to define
+   NOMACROS so the native <curses.h> doesn't define clear which interferes
+   with the clear member of class string_file.  ncurses potentially has a
+   similar problem and fix.  */
+#define NOMACROS
+#define NCURSES_NOMACROS
+
 #if defined (HAVE_NCURSES_NCURSES_H)
 #include <ncurses/ncurses.h>
 #elif defined (HAVE_NCURSES_H)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]