MinGW versus _strtoui64() ?

Started by Tom Lanealmost 10 years ago5 messages
#1Tom Lane
tgl@sss.pgh.pa.us

Per a comment from Petr Jelinek, I added this in commit 23a27b039d94ba35:

#ifdef WIN32
return _strtoui64(str, endptr, base);
#else ...

Several of the Windows buildfarm members are good with that, but
narwhal is not:

numutils.c: In function `pg_strtouint64':
numutils.c:406: warning: implicit declaration of function `_strtoui64'
...
Creating library file: libpostgres.a
utils/adt/numutils.o(.text+0x67b): In function `pg_strtouint64':
C:/msys/1.0/local/pgbuildfarm/buildroot/HEAD/pgsql.build/src/backend/utils/adt/numutils.c:406: undefined reference to `_strtoui64'
collect2: ld returned 1 exit status

Any thoughts how to fix that?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Petr Jelinek
petr@2ndquadrant.com
In reply to: Tom Lane (#1)
Re: MinGW versus _strtoui64() ?

On 13/03/16 03:30, Tom Lane wrote:

Per a comment from Petr Jelinek, I added this in commit 23a27b039d94ba35:

#ifdef WIN32
return _strtoui64(str, endptr, base);
#else ...

Several of the Windows buildfarm members are good with that, but
narwhal is not:

numutils.c: In function `pg_strtouint64':
numutils.c:406: warning: implicit declaration of function `_strtoui64'
...
Creating library file: libpostgres.a
utils/adt/numutils.o(.text+0x67b): In function `pg_strtouint64':
C:/msys/1.0/local/pgbuildfarm/buildroot/HEAD/pgsql.build/src/backend/utils/adt/numutils.c:406: undefined reference to `_strtoui64'
collect2: ld returned 1 exit status

Looks like it has to be limited to MSVC not WIN32, mingw does not have it.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Petr Jelinek (#2)
Re: MinGW versus _strtoui64() ?

Petr Jelinek <petr@2ndquadrant.com> writes:

On 13/03/16 03:30, Tom Lane wrote:

Per a comment from Petr Jelinek, I added this in commit 23a27b039d94ba35:

#ifdef WIN32
return _strtoui64(str, endptr, base);
#else ...

Several of the Windows buildfarm members are good with that, but
narwhal is not:

Looks like it has to be limited to MSVC not WIN32, mingw does not have it.

So you're thinking "#ifdef _MSC_VER"? Or something else?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Petr Jelinek
petr@2ndquadrant.com
In reply to: Tom Lane (#3)
Re: MinGW versus _strtoui64() ?

On 13/03/16 04:24, Tom Lane wrote:

Petr Jelinek <petr@2ndquadrant.com> writes:

On 13/03/16 03:30, Tom Lane wrote:

Per a comment from Petr Jelinek, I added this in commit 23a27b039d94ba35:

#ifdef WIN32
return _strtoui64(str, endptr, base);
#else ...

Several of the Windows buildfarm members are good with that, but
narwhal is not:

Looks like it has to be limited to MSVC not WIN32, mingw does not have it.

So you're thinking "#ifdef _MSC_VER"? Or something else?

Sorry for brevity, yes, that should work, afaics mingw has strtoul so
the code should compile fine with that ifdef. Also just checked to make
sure, the _strtoui64 was added in VS 7.0 (the version before VS 2003) so
should work well enough compatibility wise.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Petr Jelinek (#4)
Re: MinGW versus _strtoui64() ?

Petr Jelinek <petr@2ndquadrant.com> writes:

On 13/03/16 04:24, Tom Lane wrote:

So you're thinking "#ifdef _MSC_VER"? Or something else?

Sorry for brevity, yes, that should work, afaics mingw has strtoul so
the code should compile fine with that ifdef. Also just checked to make
sure, the _strtoui64 was added in VS 7.0 (the version before VS 2003) so
should work well enough compatibility wise.

Pushed that way. Thanks for the help!

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers