From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63678 invoked by alias); 20 Sep 2017 23:25:36 -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 63660 invoked by uid 89); 20 Sep 2017 23:25:36 -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=Imagine, Hx-languages-length:1878, scb 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; Wed, 20 Sep 2017 23:25:35 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C65B4C047B9A for ; Wed, 20 Sep 2017 23:25:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C65B4C047B9A Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com 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 2FAF8614C4; Wed, 20 Sep 2017 23:25:30 +0000 (UTC) Subject: Re: [PATCH v2 1/5] Import "glob" and "getcwd" modules from gnulib To: Sergio Durigan Junior References: <20170912042325.14927-1-sergiodj@redhat.com> <20170919042842.9210-1-sergiodj@redhat.com> <87y3pbwbgl.fsf@redhat.com> <0f9f2e47-dc17-0bd8-5445-0cf40160929e@redhat.com> <8760cdp9w7.fsf@redhat.com> <87shfhnrwp.fsf@redhat.com> <87shfhdsel.fsf@redhat.com> <4dd4a416-7381-a556-1770-a636df65fe8a@redhat.com> <87ingd9d7g.fsf@redhat.com> Cc: GDB Patches From: Pedro Alves Message-ID: Date: Wed, 20 Sep 2017 23:25: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: <87ingd9d7g.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00525.txt.bz2 On 09/21/2017 12:12 AM, Sergio Durigan Junior wrote: > On Wednesday, September 20 2017, Pedro Alves wrote: > >> (There's no need of wrap #undef with #ifdef/#endif. That's redundant.) >> >> That'd #undef 'close' on all hosts, even if gnulib decides to >> replace it for some reason. E.g., REPLACE_FCHDIR >> check in rpl_close (see my previous email). > > Not all hosts; only on hosts that define USE_WIN32API. This would > basically make sure we stick to the current behaviour, which is to > always define "close" as "closesocket" on win32. Ah, this is all wrapped in #ifdef USE_WIN32API. Missed that, somehow. > >> How about we switch close/closesocket around: >> >> #ifndef USE_WIN32API >> # define closesocket close >> #endif >> >> And then use closesocket instead of close? > > That'd work, but my preference is to use "close" everywhere because > that's the de facto way of dealing with sockets. Only win32 hosts need > this "closesocket" thing, and I don't think it makes sense to base use > this name in our sources. > > But that's my opinion; if you want, I can reverse the logic on the > define's. I don't see the problem. Imagine it as if struct serial had been C++-ified already, making struct ser_tcp a class, and we added a private method like this: void ser_tcp::closesocket () { #ifdef USE_WIN32API ::closesocket (fd); #else close (fd); #endif } Then we'd be calling closesocket instead of close. :-) Actually, that's pretty much the existing net_close, and we call it in several places instead of close directly in very nearby code: ... close (scb->fd); goto retry; } if (err) errno = err; net_close (scb); ... Eh. But I digress... The #undef close approach is fine with me too since it turns out that's wrapped in #if USE_WIN32API, and I missed it the first time. Thanks, Pedro Alves