From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2785 invoked by alias); 18 May 2017 13:36:34 -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 2650 invoked by uid 89); 18 May 2017 13:36:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 May 2017 13:36:29 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id F31B130B; Thu, 18 May 2017 15:36:30 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dqvfQvEsbOL1; Thu, 18 May 2017 15:36:28 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 0039330A; Thu, 18 May 2017 15:36:27 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id v4IDaRTU026763; Thu, 18 May 2017 15:36:27 +0200 (MEST) From: Rainer Orth To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: Fix tui compilation with Solaris libcurses (PR tui/21482) References: <32521e83-00b5-e2a8-faff-03b5407cfc67@redhat.com> Date: Thu, 18 May 2017 13:36:00 -0000 In-Reply-To: <32521e83-00b5-e2a8-faff-03b5407cfc67@redhat.com> (Pedro Alves's message of "Thu, 18 May 2017 14:19:40 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-05/txt/msg00421.txt.bz2 Hi Pedro, >> It turned out this happens because has >>=20 >> #define clear() wclear(stdscr) >>=20 >> 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 probably of SysVr4 origin ultimately: at least I already found it in those sources. > checks NCURSES_NOMACROS instead of NOMACROS, we could define that too. Makes sense (unless this creates problems of its own ;-). >> * Even with this workaround, compilation fails in gdb/tui for several >> instances of the same problem: >>=20 >> /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c: In functi= on =E2=80=98void tui_erase_source_content(tui_win_info*, int)=E2=80=99: >> /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:257:18: er= ror: invalid conversion from =E2=80=98const char*=E2=80=99 to =E2=80=98char= *=E2=80=99 [-fpermissive] >> no_src_str); >> ^ >> In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curs= es.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:69= 9:12: note: initializing argument 4 of =E2=80=98int mvwaddstr(WINDOW*, in= t, int, char*)=E2=80=99 >> extern int mvwaddstr(WINDOW *, int, int, char *); >> ^~~~~~~~~ >> make[2]: *** [Makefile:1927: tui-winsource.o] Error 1 >>=20 >> Unlike ncurses, declares=20 >>=20 >> extern int mvwaddstr(WINDOW *, int, int, char *); >>=20 >> i.e. the last arg is char *, not const char *. >>=20 >> 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. This way you centralize the knowledge why you are doing this in once header rather than several calls/casts. I guess we'll cross that bridge once another function causes similar trouble. >> 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: >>=20 >> Undefined first referenced >> symbol in file >> wattr_on tui-wingeneral.o >> wattr_off tui-wingeneral.o >>=20 >> 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). Fine with me. I'll look at the ncurses header vs. libcurses issue later: so far I've just been lazy and manually linked gdb if I hit it. >> 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 > . The move makes sense to me: I just wasn't aware of that file. I'll prepare a separate patch. Thanks. Rainer --=20 ---------------------------------------------------------------------------= -- Rainer Orth, Center for Biotechnology, Bielefeld University