compiler warnings on mingw

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема compiler warnings on mingw
Дата
Msg-id 1340617349.13589.18.camel@vanquo.pezone.net
обсуждение исходный текст
Ответы Re: compiler warnings on mingw  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
I've tried to cross-compile PostgreSQL from Linux to Windows, following
the ideas of Andrew Dunstan [0].  This works quite well.  I see two
compiler warnings altogether, which might be worth getting rid of:

#1

mingwcompat.c:60:1: warning: ‘RegisterWaitForSingleObject’ redeclared without dllimport attribute: previous dllimport
ignored[-Wattributes]
 

This can apparently go away with this:

diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c
index 0978e8c..b1a5ca5 100644
--- a/src/backend/port/win32/mingwcompat.c
+++ b/src/backend/port/win32/mingwcompat.c
@@ -56,6 +56,7 @@           (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);static
__RegisterWaitForSingleObject_RegisterWaitForSingleObject = NULL;
 
+__attribute__((dllimport))BOOL       WINAPIRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
  HANDLE hObject,
 

Oddly, the mingw buildfarm member[1] complains about

mingwcompat.c:66: warning: no previous prototype for 'RegisterWaitForSingleObject'

instead.  So there might be some divergent header files around.

Anyone know details about this?

#2

pg_stat_statements.c: In function ‘pgss_ProcessUtility’:
pg_stat_statements.c:840:4: warning: unknown conversion type character ‘l’ in format [-Wformat]
pg_stat_statements.c:840:4: warning: too many arguments for format [-Wformat-extra-args]

We use a replacement snprintf and set the int64 format to %lld and %llu
based on that.  But pg_stat_statements.c uses sscanf, for which we have
no replacement.  The configure check comments

# MinGW uses '%I64d', though gcc throws an warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.

So assuming that sscanf in the mingw C library works consistently with
snprintf, that might mean that pg_stat_statements is broken on that
platform.  (The claim that %lld doesn't generate a warning is also
questionable here.)


[0]: http://people.planetpostgresql.org/andrew/index.php?/archives/264-Cross-compiling-PostgreSQL-for-WIndows.html
[1]: http://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=narwhal&dt=2012-06-22%2004%3A00%3A05&stg=make

PS: Instructions for Debian:

apt-get install gcc-mingw-w64

./configure --build=$(config/config.guess) --host=i686-w64-mingw32 --without-zlib --without-readline ZIC=/usr/sbin/zic
make world




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vlad Arkhipov
Дата:
Сообщение: Re: temporal support patch
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: compiler warnings on mingw