Re: [HACKERS] compiler warnings under MinGW for 9.4

2015-01-06 Thread Michael Paquier
On Tue, Dec 9, 2014 at 4:45 AM, Jeff Janes  wrote:
> In the past, building under MinGW produced so many warnings that I never
> bothered to read them.
>
> Now most of them have been removed, so the ones that are left might be worth
> reporting.
>
> Using gcc.exe (GCC) 4.6.2 on REL9_4_STABLE
> eadd80c08ddfc485db84b9af7cca54a0d50ebe6d I get:
>
> mingwcompat.c:60:1: warning: 'RegisterWaitForSingleObject' redeclared
> without dllimport attribute: previous dllimport ignored [-Wattributes]
> input.c:382:1: warning: 'saveHistory' defined but not used
> [-Wunused-function]
>
> Does anyone have opinions on how to address these?
Compiling with MinGW-32b, I am getting more of those than the ones you
mention, per se the attached. I'll try to come up with a patch to
reduce this amount on master.
-- 
Michael
configure: WARNING: *** Readline does not work on MinGW --- disabling
configure: WARNING: *** skipping thread test on Win32
dirmod.c: In function 'pgwin32_safestat':
dirmod.c:369:2: warning: implicit declaration of function 'stat' 
[-Wimplicit-function-declaration]
  r = stat(path, buf);
  ^
dirmod.c: In function 'pgwin32_safestat':
dirmod.c:369:2: warning: implicit declaration of function 'stat' 
[-Wimplicit-function-declaration]
  r = stat(path, buf);
  ^
twophase.c: In function 'ReadTwoPhaseFile':
twophase.c:1252:2: warning: passing argument 2 of '_fstat64i32' from 
incompatible pointer type [enabled by default]
  if (fstat(fd, &stat))
  ^
In file included from ../../../../src/include/port.h:283:0,
 from ../../../../src/include/c.h:1050,
 from ../../../../src/include/postgres.h:47,
 from twophase.c:36:
c:\mingw\include\sys\stat.h:200:32: note: expected 'struct _stat64i32 *' but 
argument is of type 'struct stat *'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) 
{
^
In file included from gram.y:14321:0:
scan.c: In function 'yy_try_NUL_trans':
scan.c:10188:23: warning: unused variable 'yyg' [-Wunused-variable]
 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be 
unused depending upon options. */
   ^
copy.c: In function 'BeginCopyTo':
copy.c:1710:4: warning: passing argument 2 of '_fstat64i32' from incompatible 
pointer type [enabled by default]
fstat(fileno(cstate->copy_file), &st);
^
In file included from ../../../src/include/port.h:283:0,
 from ../../../src/include/c.h:1050,
 from ../../../src/include/postgres.h:47,
 from copy.c:15:
c:\mingw\include\sys\stat.h:200:32: note: expected 'struct _stat64i32 *' but 
argument is of type 'struct stat *'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) 
{
^
copy.c: In function 'BeginCopyFrom':
copy.c:2721:4: warning: passing argument 2 of '_fstat64i32' from incompatible 
pointer type [enabled by default]
fstat(fileno(cstate->copy_file), &st);
^
In file included from ../../../src/include/port.h:283:0,
 from ../../../src/include/c.h:1050,
 from ../../../src/include/postgres.h:47,
 from copy.c:15:
c:\mingw\include\sys\stat.h:200:32: note: expected 'struct _stat64i32 *' but 
argument is of type 'struct stat *'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) 
{
^
md5.c:88:0: warning: "G" redefined [enabled by default]
 #define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
 ^
:0:0: note: this is the location of the previous definition
basebackup.c: In function 'perform_base_backup':
basebackup.c:461:4: warning: passing argument 2 of '_fstat64i32' from 
incompatible pointer type [enabled by default]
if (fstat(fileno(fp), &statbuf) != 0)
^
In file included from ../../../src/include/port.h:283:0,
 from ../../../src/include/c.h:1050,
 from ../../../src/include/postgres.h:47,
 from basebackup.c:13:
c:\mingw\include\sys\stat.h:200:32: note: expected 'struct _stat64i32 *' but 
argument is of type 'struct stat *'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) 
{
^
snapmgr.c: In function 'ImportSnapshot':
snapmgr.c:1142:2: warning: passing argument 2 of '_fstat64i32' from 
incompatible pointer type [enabled by default]
  if (fstat(fileno(f), &stat_buf))
  ^
In file included from ../../../../src/include/port.h:283:0,
 from ../../../../src/include/c.h:1050,
 from ../../../../src/include/postgres.h:47,
 from snapmgr.c:42:
c:\mingw\include\sys\stat.h:200:32: note: expected 'struct _stat64i32 *' but 
argument is of type 'struct stat *'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) 
{
^
fe-connect.c: In function 'parseServiceInfo':
fe-connect.c:3899:3: warning: implicit declarat

[HACKERS] compiler warnings under MinGW for 9.4

2014-12-08 Thread Jeff Janes
In the past, building under MinGW produced so many warnings that I never
bothered to read them.

Now most of them have been removed, so the ones that are left might be
worth reporting.

Using gcc.exe (GCC) 4.6.2 on REL9_4_STABLE
eadd80c08ddfc485db84b9af7cca54a0d50ebe6d I get:

mingwcompat.c:60:1: warning: 'RegisterWaitForSingleObject' redeclared
without dllimport attribute: previous dllimport ignored [-Wattributes]
input.c:382:1: warning: 'saveHistory' defined but not used
[-Wunused-function]

Does anyone have opinions on how to address these?


Cheers,

Jeff