On Wed, Mar 14, 2018 at 11:23:35AM -0400, Tom Lane wrote:
> Peter Eisentraut <peter.eisentr...@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
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;
 
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
 
 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 */

Attachment: signature.asc
Description: PGP signature

Reply via email to