Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyiCW-0006YC-VL for pgsql-committers@arkaria.postgresql.org; Fri, 25 Nov 2022 23:33:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oyiCV-0000XF-Rk for pgsql-committers@arkaria.postgresql.org; Fri, 25 Nov 2022 23:33:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyiCV-0000X6-Kd for pgsql-committers@lists.postgresql.org; Fri, 25 Nov 2022 23:33:43 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyiCO-00062Y-C5 for pgsql-committers@lists.postgresql.org; Fri, 25 Nov 2022 23:33:43 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 52DDF5C00E6; Fri, 25 Nov 2022 18:33:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 25 Nov 2022 18:33:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1669419213; x=1669505613; bh=bSLO46JeK8 BGPGjPW5+82W6EPGDG1k9gf98ZLu6t7oo=; b=PmSUZOCiw55df4V6QS1EzAclCo F8RC/78n4cuJgnrWk4/Rup88uCwaEN/3IwpzWuPhrWGWt61ERVhpJKU45UQIdV6W HNy7jTX2IdDOErAfy5HNwspODr87KQXaonj29a180z4XedvI17zz7qYE0BwJZRjO 4WfDL+98IN7CN7V2ZPODQ/JMT2zQqc4JWzLBGNIDYSIvTcDyUKKY8pM/tfEexjOa sPTmBWouRmEimDOJ025drVDZxIcW9BX7/Q86IGthmH5RYBDQ450UxJEC+qWt38ad 1tLVx0fB2wnyF9BOK24nFSZ2bYG0vqr7nDTcw+326l0JdBpnF+nr2zHOtpvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1669419213; x=1669505613; bh=bSLO46JeK8BGPGjPW5+82W6EPGDG 1k9gf98ZLu6t7oo=; b=dpqDV5HY8Mz8kKS6No+NaC367Rz/RiswK+v+8Ua/Voee 67wNJQvRCmWZLE4Z7eOvh/6rt6UkKX4xWenX8EwsNAnfUzvHL3IBSv993MQavh+O IRGEMLrDlGQpiufwTXklNn8B816/o9xrGfz9xYG/oMruWHHU3WKUC+ygW1FTZxKo JoY8H+3+Dz2DHEDz80A7q+9ae4SrR5xGLgENFIRUxVgzFyDgvk6Uf9ZUZE21Ucxx vl38H4L3E8dsmyh3pPv1J+YVLaY1yQL/CbzXko6e10bwaRFk/rjIodFePfI86Xuk 0x6L6aH9OLNKsYklrBKOiiozMSrnUE3TS8jA4j9Tqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrieeigddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpeegteevjeduueduuefhfedtffehtefgvedufedtfeevgfeifefgjeduvdff geefkeenucffohhmrghinhepphhoshhtghhrrdgvshenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdgu vg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 25 Nov 2022 18:33:32 -0500 (EST) Date: Fri, 25 Nov 2022 15:33:31 -0800 From: Andres Freund To: Andrew Dunstan Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Allow building with MSVC and Strawberry perl Message-ID: <20221125233331.dh4yrd76a3mnwj4s@awork3.anarazel.de> References: <02b5e6c8-a062-94f0-1add-db1fd1db5f0b@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02b5e6c8-a062-94f0-1add-db1fd1db5f0b@dunslane.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-11-25 17:11:51 -0500, Andrew Dunstan wrote: > On 2022-11-25 Fr 15:38, Andrew Dunstan wrote: > > Allow building with MSVC and Strawberry perl > > > > Strawberry uses __builtin_expect which Visual C doesn't have. For this > > case define it as a noop. Solution taken from vim sources. FWIW, to get a newer strawberry perl to work with msvc we need more than this. At the very least -DNO_THREAD_SAFE_LOCALE, see https://postgr.es/m/20220130221659.tlyr2lbw3wk22owg%40alap3.anarazel.de > > Argh! drongo doesn't seem to like this. I thought I'd tested it. > > A little further googling suggests that instead of > > > #define __builtin_expect(expr, val) (expr) > > > we should probably have something like > > > #define __builtin_expect(expr, val) ((expr) == (val)) That doesn't seem right - val isn't something to compare to, it's the expected return value. This afaict would compute bogus value in a number of scenarios. Note that perl's own definition is: #ifdef HAS_BUILTIN_EXPECT # define EXPECT(expr,val) __builtin_expect(expr,val) #else # define EXPECT(expr,val) (expr) #endif So we really should be able to get away with #define __builtin_expect(expr, val) (expr) I don't see why drongo's problems would go away with #define __builtin_expect(expr, val) ((expr) == (val)) anyway? FWIW a meson build with msvc 2019 and strawberry perl 5.32 builds fine with #define __builtin_expect(expr, val) (expr) Greetings, Andres Freund