From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51583 invoked by alias); 20 Sep 2017 23:12:39 -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 51573 invoked by uid 89); 20 Sep 2017 23:12:39 -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= 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:12:37 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83872C057FA6 for ; Wed, 20 Sep 2017 23:12:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 83872C057FA6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=sergiodj@redhat.com Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C60F600C2; Wed, 20 Sep 2017 23:12:36 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches Subject: Re: [PATCH v2 1/5] Import "glob" and "getcwd" modules from gnulib 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> Date: Wed, 20 Sep 2017 23:12:00 -0000 In-Reply-To: <4dd4a416-7381-a556-1770-a636df65fe8a@redhat.com> (Pedro Alves's message of "Wed, 20 Sep 2017 23:43:54 +0100") Message-ID: <87ingd9d7g.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00524.txt.bz2 On Wednesday, September 20 2017, Pedro Alves wrote: > On 09/20/2017 09:30 PM, Sergio Durigan Junior wrote: >> On Wednesday, September 20 2017, I wrote: >> >>> On Wednesday, September 20 2017, Pedro Alves wrote: >>> >>>> This is all wrapped in #ifdef WINDOWS_SOCKETS, hence the question. >>>> >>>> It should be easy for you to determine whether WINDOWS_SOCKETS >>>> is defined in your mingw build, and thus whether all this code >>>> is part of the build or not. >>> >>> I will do that and report back. Thanks, >> >> WINDOWS_SOCKETS is not defined when building with the mingw compiler >> from Fedora. This means that removing that "#define" was actually not >> correct, because "close" will not work as expected even with gnulib. > > Looks like it's defined by gnulib/m4/socketlib.m4, and seemingly > we're not pulling in that module. > >> >> My proposal is to define "close" as it was being defined before, but >> actually "#undef" it if it's already defined by other headers, like: >> >> #ifdef close >> #undef close >> #endif >> #define close(fd) closesocket (fd) >> >> Does that work for you? >> > > (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. > 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. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/