Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewGlU-00069u-HB for pgsql-committers@arkaria.postgresql.org; Thu, 15 Mar 2018 00:29:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewGlT-0000tW-CF for pgsql-committers@arkaria.postgresql.org; Thu, 15 Mar 2018 00:29:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewGlT-0000tM-6q for pgsql-committers@lists.postgresql.org; Thu, 15 Mar 2018 00:29:03 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewGlP-0003YR-Th for pgsql-committers@postgresql.org; Thu, 15 Mar 2018 00:29:02 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id A243BF69; Wed, 14 Mar 2018 20:28:58 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 14 Mar 2018 20:28:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=i9NmoSa22MnWRBgK3HZT96wtyDRKzm/aIltbqRYyPw4=; b=hWhc4M9/ ZuJYOVUKNoKKPITL93PZ050g3cZhAQQ5MEk/oGMRtr5dcX4yUeHXzrPKaj4HfwYu Pi9C6pni8k6HHC5MF5wgeI7YstFlXqGaIiS9Toru3WbrAhpdoEFPBJIDIznrWGHS 1qJgmHDsVJ5rM2b9f5f+jp7xM9ykhSY/1zkAhw2lgzDFG4ylYn2bM8ca5trvR7QU 6yrbWDwRMfAUcKyy85exFO5KnSQVANLPRrQOucJrQub50nriEIzIhLLj2BlShMIM ZhniupTY8ywvOSrDUxbZtZVuWzeK7HXK9nRgnoxUM1uUV1HKyQv7Js8/6Ty4nIQi 9GH5coNtgiUHNg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=i9NmoSa22MnWRBgK3HZT96wtyDRKz m/aIltbqRYyPw4=; b=gpuhqechUHW1UBSjttZHmY0MxZxIUFrPQFugGTvboYOQ0 9lMniEsECmmS+BxGbgJ2fOV8/xvCqx022S3SThH/WQC20uEJ/Az31Q1pw09n6x3u R1scrofNpKHn7oMOaFmMFpM31nltm2tF7TDhvSZdfeI07fq7y61I5mXmTkJHj1Tg NNIIN1GbRqSQnnPwPHODzaT1PHyr3EOxnp7yolxVl+CNogOcZEwwaQwhDQp2Ia36 vCC0zH5L5ECQStSBfgBOPS7fJaaQo3VJCA3gVs2HoBbDSUTuA9O5ehfO/hj1QoDg GNjqDIWBzL3SzswvpRTM8QLn28XLPNSl7r4iNVQEw== X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 32A7824141; Wed, 14 Mar 2018 20:28:55 -0400 (EDT) Date: Thu, 15 Mar 2018 09:28:51 +0900 From: Michael Paquier To: Tom Lane Cc: Peter Eisentraut , David Rowley , pgsql-committers Subject: Re: pgsql: Move strtoint() to common Message-ID: <20180315002851.GC617@paquier.xyz> References: <29889.1520968202@sss.pgh.pa.us> <4ca0838e-9cd3-bfae-b6b8-51ba0eabcabe@2ndquadrant.com> <24955.1521041015@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GyRA7555PLgSTuth" Content-Disposition: inline In-Reply-To: <24955.1521041015@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --GyRA7555PLgSTuth Content-Type: multipart/mixed; boundary="mvpLiMfbWzRoNl4x" Content-Disposition: inline --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 14, 2018 at 11:23:35AM -0400, Tom Lane wrote: > Peter Eisentraut writes: > > I think the problem is rather that we somehow need to tell it to link > > src/common/string.c into pgtypeslib. >=20 > Yeah, that's what I supposed. >=20 > Looking at pgtypeslib, there's already infrastructure for collecting > stuff from src/port/, and I see you added some for src/common/ in > its Makefile, but evidently not in the MSVC scripts. It looks like > the way the MSVC build works now is dependent on @pgportfiles. >=20 > You could invent parallel infrastructure for src/common/, but I wonder > whether the path of least resistance might not be to put strtoint() > into src/port/ instead. This line from the buildfarm failures is indicating that the handling of restrict is incorrect: src/common/string.c(50): error C2146: syntax error : missing ')' before identifier 'str' [C:\buildfarm\buildenv\HEAD\pgsql.build\libpgtypes.vcxproj] So I concur with David that we ought to do something for that. One way to do things simply is to remove the restrict keyword as suggested upthread. Another one, which David has not considered, is that there is a pg_restrict macro defined in pg_config.h. So you could just use that. Attached is a patch which fixes the compilation failure on Windows for me. That should put the buildfarm back to green. -- Michael --mvpLiMfbWzRoNl4x Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fix-msvc-compile.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/common/string.c b/src/common/string.c index a45e9b8858..3260d37a84 100644 --- a/src/common/string.c +++ b/src/common/string.c @@ -47,7 +47,7 @@ pg_str_endswith(const char *str, const char *end) * strtoint --- just like strtol, but returns int not long */ int -strtoint(const char *restrict str, char **restrict endptr, int base) +strtoint(const char *pg_restrict str, char **pg_restrict endptr, int base) { long val; =20 diff --git a/src/include/common/string.h b/src/include/common/string.h index 23e2e01f0e..63c3e81a64 100644 --- a/src/include/common/string.h +++ b/src/include/common/string.h @@ -11,6 +11,7 @@ #define COMMON_STRING_H =20 extern bool pg_str_endswith(const char *str, const char *end); -extern int strtoint(const char *restrict str, char **restrict endptr, int = base); +extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr, + int base); =20 #endif /* COMMON_STRING_H */ --mvpLiMfbWzRoNl4x-- --GyRA7555PLgSTuth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlqpvkMACgkQnvQgOdby QH0PFQ/+KoktA4Vb7/1JscEcrGFeTkvyQNuxL5Vn7FHPKGA5HvTsrPWuzYk2FOBK NtK3eLbMUA1N5BzNt3pmxaEfbKtigLn4XqXPOz1ISm3MwOnP7Joj0/ZCqy08e0dd yFjhslsRFymeN/EbweDwihENxZRmRLZzZe4whIlC0I/xIM2R9ULWEG8QMvYdzmTG hKZgRLk3fUGd0xzrguFGgs67pcIJXk6lK+bqBNrzzt0bDoGmO1a9WJvOvKzdnai7 ho1deAElnS6hbmsNRSZuqvQM8tjzRaos1FmFfiDXCDketYmc1pxAUUjAhz6GUe7Q 5x3tWh4Aoc2ZLUYBANyyama6c4LsitNpx/TYzNoHK99GBOAJeu5a7oL27ipPokvz iiQ0+Mp+2kedx/FPCz5mz0KxrDOdC+U/5ECzg+K2ObHH7t1rHU8Nry11ysJ53v7E qYQj524WAsYhWsBUI8GMOJQcRVn3KkT1PdtxV/jH33tGC5mdhF61/r+FQEqMMb8j 7Gk2bf6kEYhxQfYYU0yvMGGSne+kOWE3tDJkneZSVokg8ttOFFVKO/q1lPX8EUA9 DWiFPeRYdEzW3c5rx99EGy2f7C2zetk/CnlibQmDIG4vs0b0yVkhs8gl5nEiO0Ea t+b5rN1l+wRDbtJkJcQfmBCaNUIInImw+5kHFgP7HztD/BN3RQo= =onay -----END PGP SIGNATURE----- --GyRA7555PLgSTuth--