Observed Compilation warning in WIN32 build

Started by Rajeev rastogialmost 12 years ago3 messages
#1Rajeev rastogi
rajeev.rastogi@huawei.com
1 attachment(s)

I observed below WIN32 compilation warnings in postmaster.c (seems introduced by commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f "Relax the requirement that all lwlocks be stored in a single array.").

1>.\src\backend\postmaster\postmaster.c(5625) : warning C4133: '=' : incompatible types - from 'LWLockPadded *' to 'LWLock *'
1>.\src\backend\postmaster\postmaster.c(5856) : warning C4133: '=' : incompatible types - from 'LWLock *' to 'LWLockPadded *'

Attached is the patch with the fix.

Thanks and Regards,
Kumar Rajeev Rastogi

Attachments:

compile_issue_lwlock.patchapplication/octet-stream; name=compile_issue_lwlock.patchDownload
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 5622,5628 **** save_backend_variables(BackendParameters *param, Port *port,
  #ifndef HAVE_SPINLOCKS
  	param->SpinlockSemaArray = SpinlockSemaArray;
  #endif
! 	param->MainLWLockArray = MainLWLockArray;
  	param->ProcStructLock = ProcStructLock;
  	param->ProcGlobal = ProcGlobal;
  	param->AuxiliaryProcs = AuxiliaryProcs;
--- 5622,5628 ----
  #ifndef HAVE_SPINLOCKS
  	param->SpinlockSemaArray = SpinlockSemaArray;
  #endif
! 	param->MainLWLockArray = (LWLock*)MainLWLockArray;
  	param->ProcStructLock = ProcStructLock;
  	param->ProcGlobal = ProcGlobal;
  	param->AuxiliaryProcs = AuxiliaryProcs;
***************
*** 5853,5859 **** restore_backend_variables(BackendParameters *param, Port *port)
  #ifndef HAVE_SPINLOCKS
  	SpinlockSemaArray = param->SpinlockSemaArray;
  #endif
! 	MainLWLockArray = param->MainLWLockArray;
  	ProcStructLock = param->ProcStructLock;
  	ProcGlobal = param->ProcGlobal;
  	AuxiliaryProcs = param->AuxiliaryProcs;
--- 5853,5859 ----
  #ifndef HAVE_SPINLOCKS
  	SpinlockSemaArray = param->SpinlockSemaArray;
  #endif
! 	MainLWLockArray = (LWLockPadded*)param->MainLWLockArray;
  	ProcStructLock = param->ProcStructLock;
  	ProcGlobal = param->ProcGlobal;
  	AuxiliaryProcs = param->AuxiliaryProcs;
#2Andres Freund
andres@2ndquadrant.com
In reply to: Rajeev rastogi (#1)
Re: Observed Compilation warning in WIN32 build

On 2014-01-28 09:13:15 +0000, Rajeev rastogi wrote:

I observed below WIN32 compilation warnings in postmaster.c (seems introduced by commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f "Relax the requirement that all lwlocks be stored in a single array.").

1>.\src\backend\postmaster\postmaster.c(5625) : warning C4133: '=' : incompatible types - from 'LWLockPadded *' to 'LWLock *'
1>.\src\backend\postmaster\postmaster.c(5856) : warning C4133: '=' : incompatible types - from 'LWLock *' to 'LWLockPadded *'

Attached is the patch with the fix.

Thanks and Regards,
Kumar Rajeev Rastogi

*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 5622,5628 **** save_backend_variables(BackendParameters *param, Port *port,
#ifndef HAVE_SPINLOCKS
param->SpinlockSemaArray = SpinlockSemaArray;
#endif
! 	param->MainLWLockArray = MainLWLockArray;
param->ProcStructLock = ProcStructLock;
param->ProcGlobal = ProcGlobal;
param->AuxiliaryProcs = AuxiliaryProcs;
--- 5622,5628 ----
#ifndef HAVE_SPINLOCKS
param->SpinlockSemaArray = SpinlockSemaArray;
#endif
! 	param->MainLWLockArray = (LWLock*)MainLWLockArray;
param->ProcStructLock = ProcStructLock;
param->ProcGlobal = ProcGlobal;
param->AuxiliaryProcs = AuxiliaryProcs;
***************
*** 5853,5859 **** restore_backend_variables(BackendParameters *param, Port *port)
#ifndef HAVE_SPINLOCKS
SpinlockSemaArray = param->SpinlockSemaArray;
#endif
! 	MainLWLockArray = param->MainLWLockArray;
ProcStructLock = param->ProcStructLock;
ProcGlobal = param->ProcGlobal;
AuxiliaryProcs = param->AuxiliaryProcs;
--- 5853,5859 ----
#ifndef HAVE_SPINLOCKS
SpinlockSemaArray = param->SpinlockSemaArray;
#endif
! 	MainLWLockArray = (LWLockPadded*)param->MainLWLockArray;
ProcStructLock = param->ProcStructLock;
ProcGlobal = param->ProcGlobal;
AuxiliaryProcs = param->AuxiliaryProcs;

This strikes me as the wrong fix, the types in BackendParams should be
changed instead.

Greetings,

Andres Freund

--
Andres Freund 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

#3Robert Haas
robertmhaas@gmail.com
In reply to: Andres Freund (#2)
Re: Observed Compilation warning in WIN32 build

On Tue, Jan 28, 2014 at 6:28 AM, Andres Freund <andres@2ndquadrant.com> wrote:

On 2014-01-28 09:13:15 +0000, Rajeev rastogi wrote:

I observed below WIN32 compilation warnings in postmaster.c (seems introduced by commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f "Relax the requirement that all lwlocks be stored in a single array.").

This strikes me as the wrong fix, the types in BackendParams should be
changed instead.

Agreed, fixed that way.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

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