From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37125 invoked by alias); 7 Mar 2019 18:24:28 -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 37106 invoked by uid 89); 7 Mar 2019 18:24:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,LIKELY_SPAM_BODY,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 spammy=recalled, HContent-Transfer-Encoding:8bit X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Mar 2019 18:24:25 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id x27IOJ0E012936 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 7 Mar 2019 13:24:24 -0500 Received: by simark.ca (Postfix, from userid 112) id 430F01E658; Thu, 7 Mar 2019 13:24:19 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 346ED1E4A5; Thu, 7 Mar 2019 13:24:18 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 07 Mar 2019 18:24:00 -0000 From: Simon Marchi To: Pedro Alves Cc: Eli Zaretskii , gdb-patches@sourceware.org Subject: Re: MinGW build failure for GDB 8.2.90 with source-highlight In-Reply-To: <735b109f-4ae4-5993-57f0-eb548752fc23@redhat.com> References: <83r2bibvlv.fsf@gnu.org> <10c9e85f-d216-ef5c-c8ca-636331d0d1ba@redhat.com> <353a11fc68f77c293d7b706586b06724@polymtl.ca> <735b109f-4ae4-5993-57f0-eb548752fc23@redhat.com> Message-ID: <383937c5180dc6f6e3f762e45c895563@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00164.txt.bz2 On 2019-03-07 13:20, Pedro Alves wrote: > On 03/07/2019 06:09 PM, Simon Marchi wrote: >> On 2019-03-07 12:11, Pedro Alves wrote: >>> On 03/07/2019 04:59 PM, Simon Marchi wrote: >>> >>>> I don't recall what's the long term solution for this.  We could use >>>> gnulib's namespace support [2], but the disadvantage is that we >>>> would need to use gnulib::some_function (assuming we name the >>>> namespace "gnulib") instead of just some_function to use the "fixed" >>>> version.  If we use some_function directly, it will use the buggy >>>> version on those systems where it is buggy. >>> >>> Wrap all of gdb in a namespace.  Recall that this was what led to C++ >>> wildmatching support. >> >> I don't understand how this will help. > > Sorry, I thought the reference would make you recall > the previous discussions. See below. Yeah, I recalled these discussions, but I couldn't make the pieces fit in my head... >> If you have >> >> #define open rpl_open >> >> namespace gdb { >>   struct target_ops { >>     void open(); >>   } >> } >> >> The macro will still wrongfully replace open. > > See slides #16-#17 of my Cauldron 2017 presentation: > > > https://gcc.gnu.org/wiki/cauldron2017?action=AttachFile&do=view&target=gdb+-+C%2B%2B+conversion+%26+dogfood.pdf > > The idea is to put all of gdb under "namespace gdb", and also put > gnulib in the same namespace, using gnulib's namespace support. > That way, there are no macros, and, the code looks just like it > does today, except for the "namespace gdb" wrapping. > > Prototyped here: > https://github.com/palves/gdb/commits/palves/cxx-gdb-namespace Ok, the key I was missing is that gdb and gnulib are in the same namespace, so if you call "close", for example, it uses gnulib's close. Thanks! Simon