From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59337 invoked by alias); 18 May 2017 13:19:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 59324 invoked by uid 89); 18 May 2017 13:19:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=opinion X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 May 2017 13:19:40 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 846F061B91; Thu, 18 May 2017 13:19:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 846F061B91 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 846F061B91 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC4E418376; Thu, 18 May 2017 13:19:41 +0000 (UTC) Subject: Re: Fix tui compilation with Solaris libcurses (PR tui/21482) To: Rainer Orth , gdb-patches@sourceware.org References: From: Pedro Alves Message-ID: <32521e83-00b5-e2a8-faff-03b5407cfc67@redhat.com> Date: Thu, 18 May 2017 13:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-05/txt/msg00420.txt.bz2 On 05/18/2017 09:56 AM, Rainer Orth wrote: > On both mainline and the 8.0 branch, gdb compilation fails on Solaris 10 > with the native libcurses: > > * Initially, compilation failed 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 has > > #define clear() wclear(stdscr) > > This can be avoided by defining NOMACROS, which the patch below does > for solaris2.*. We already handle some curses warts in gdb_curses.h (and then include that header instead everywhere). I think this could go there, even unconditionally. (This is more about curses implementation than OS strictly speaking. Googling around finds hits for that macro in the AIX curses.h header, for example.). Looks like ncurses checks NCURSES_NOMACROS instead of NOMACROS, we could define that too. > > * Even with this workaround, compilation fails in gdb/tui for several > instances of the same problem: > > /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c: In function ‘void tui_erase_source_content(tui_win_info*, int)’: > /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:257:18: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] > no_src_str); > ^ > 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:26, > from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:33: > /vol/gcc-7/lib/gcc/sparc-sun-solaris2.10/7.1.0/include-fixed/curses.h:699:12: note: initializing argument 4 of ‘int mvwaddstr(WINDOW*, int, int, char*)’ > extern int mvwaddstr(WINDOW *, int, int, char *); > ^~~~~~~~~ > make[2]: *** [Makefile:1927: tui-winsource.o] Error 1 > > Unlike ncurses, declares > > extern int mvwaddstr(WINDOW *, int, int, char *); > > i.e. the last arg is char *, not const char *. > > The patch fixes this by casting the last arg to mvwaddstr to char *, > as was recently done on mainline in a newterm() call (the only > difference between 8.0 and mainline gdb/tui). That's fine with me. Looking at: https://docs.oracle.com/cd/E19455-01/806-0629/6j9vjco9i/index.html I see that this affects several APIs, so nicer would be to fix this centrally in gdb_curses.h like we fix e.g., PyObject_GetAttrString in python/python-internal.h. But that can be for another day. > > With those changes, gdb on the 8.0 branch compiles cleanly on > sparcv9-sun-solaris2.10 with native curses and amd64-pc-solaris2.12 > with bundled ncurses (well, almost: on Solaris 12 ncurses in > /usr/include is used, but gdb linked against -lcurses which fails: > > Undefined first referenced > symbol in file > wattr_on tui-wingeneral.o > wattr_off tui-wingeneral.o > > but that's a different and preexisting problem). These two problems would be better pushed as two separate patches (with the rationales given above as separate commit logs). > Ok for mainline and 8.0 branch? The cast bits are OK. I'd like to hear your opinion on moving the NOMACROS define to gdb_curses.h, before including . Thanks, Pedro Alves