include: Always add defines for the Interlocked* functions.
Jacek Caban
jacek at codeweavers.com
Fri Oct 15 14:38:06 CDT 2021
On 10/15/21 8:57 AM, Alexandre Julliard wrote:
> Jacek Caban <jacek at codeweavers.com> writes:
>
>> Hi Alexandre,
>>
>>
>>> -static FORCEINLINE LONG WINAPI InterlockedIncrement( LONG volatile
>> *dest )
>>> -{
>>> - return _InterlockedIncrement( (long volatile *)dest );
>>> -}
>>
>> What was wrong with those inlines? Note that the commit removes LONG*
>> to long* casts and causes warnings on clang msvc target.
> They need to be defines, for instance libxml2 does this:
>
> #ifdef InterlockedCompareExchangePointer
> InterlockedCompareExchangePointer((void **) &global_init_lock,
> cs, NULL);
> #else /* Use older void* version */
> InterlockedCompareExchange((void **) &global_init_lock,
> (void *) cs, NULL);
> #endif /* InterlockedCompareExchangePointer */
>
> which will break on 64-bit. We could of course change only that one, but
> they are all #defines in the MS headers.
>
> I think that a better fix would be to use the correct types for LONG
> etc. on PE targets.
That sounds indeed great for the final solution, those differences pop
up every now and then.
It's a lot of changes (although Michael didn't run away when I mentioned
such possibility at WineConf :) ) and a lot of warnings until then.
Another possible intermediate solution would be having inlines paired
with no-op macros like:
#define InterlockedCompareExchangePointer InterlockedCompareExchangePointer
Thanks,
Jacek
More information about the wine-devel
mailing list