bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lock warnings on mingw


From: Bruno Haible
Subject: Re: lock warnings on mingw
Date: Wed, 18 Jun 2008 02:36:05 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> The mingw headers for <windows.h> currently have a bug, where 
> Interlocked{In,De}
> crement are defined as taking LPLONG (long *) rather than the Microsoft 
> documentation [1] of LONG volatile *, triggering compiler warnings when 
> passing 
> in a pointer to volatile data.  Is it acceptable to add macros to lock.h to 
> work around this mingw deficiency when USE_WIN32_THREADS?

I vote against it. If you cast away the 'volatile', the compiler is allowed
to cache some intermediate values in registers, effectively turning the
supposedly atomic operation into a non-atomic one. I find it better to live
with the warnings rather than to introduce a bug in our code that would stay
a bug even after mingw's bug is fixed.

> [1] http://msdn.microsoft.com/en-us/library/ms683614(VS.85).aspx
> 
> ../../lib/lock.c: In function `glthread_lock_lock':
> ../../lib/lock.c:550: warning: passing arg 1 of `InterlockedIncrement' 
> discards qualifiers from pointer target type

You have diagnosed it as a mingw header bug; please report it to the mingw
maintainers if you have time.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]