From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Move strtoint() to common
Date: Thu, 15 Mar 2018 09:28:51 +0900
Message-ID: <20180315002851.GC617@paquier.xyz> (raw)
In-Reply-To: <24955.1521041015@sss.pgh.pa.us>
References: <E1evkoK-0006CC-Ce@gemulon.postgresql.org>
<29889.1520968202@sss.pgh.pa.us>
<CAKJS1f85dabhgViVjqgo6La+Jcr6Mujor1j65O8hZX43CPjXQg@mail.gmail.com>
<4ca0838e-9cd3-bfae-b6b8-51ba0eabcabe@2ndquadrant.com>
<24955.1521041015@sss.pgh.pa.us>
On Wed, Mar 14, 2018 at 11:23:35AM -0400, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> > I think the problem is rather that we somehow need to tell it to link
> > src/common/string.c into pgtypeslib.
>
> Yeah, that's what I supposed.
>
> 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.
>
> 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
Attachments:fix-msvc-compile.patch (text/x-diff, 942B) downloaddiff --git a/src/common/string.c b/src/common/string.cindex 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;
diff --git a/src/include/common/string.h b/src/include/common/string.hindex 23e2e01f0e..63c3e81a64 100644--- a/src/include/common/string.h+++ b/src/include/common/string.h@@ -11,6 +11,7 @@
#define COMMON_STRING_H
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);
#endif /* COMMON_STRING_H */
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, david.rowley@2ndquadrant.com
Subject: Re: pgsql: Move strtoint() to common
In-Reply-To: <20180315002851.GC617@paquier.xyz>
References: <E1evkoK-0006CC-Ce@gemulon.postgresql.org> <29889.1520968202@sss.pgh.pa.us> <CAKJS1f85dabhgViVjqgo6La+Jcr6Mujor1j65O8hZX43CPjXQg@mail.gmail.com> <4ca0838e-9cd3-bfae-b6b8-51ba0eabcabe@2ndquadrant.com> <24955.1521041015@sss.pgh.pa.us> <20180315002851.GC617@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox