This is the mail archive of the
mailing list for the GCC project.
Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.
- From: Jacek Caban <cjacek at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Kai Tietz <ktietz70 at googlemail dot com>
- Date: Wed, 18 Sep 2013 11:14:18 +0200
- Subject: Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.
- Authentication-results: sourceware.org; auth=none
- References: <52383ABB dot 5010404 at gmail dot com> <52396AF7 dot 1040901 at redhat dot com>
On 09/18/13 10:57, Pedro Alves wrote:
> On 09/17/2013 12:19 PM, Jacek Caban wrote:
>> This is no-op for usual GCC targets, because we don't pass any string to
>> CreateSemaphore anyway. However this trivial change will help
>> mingw-w64's efforts to support WinRT, where only unicode variant is
>> config/i386/gthr-win32.c: CreateSemaphoreW instead of CreateSemaphoreA.
>> config/i386/gthr-win32.h: Likewise.
> I'm a bit puzzled and curious about why you actually need this (and other
> similar patches), since the Windows CE port manages without them, and there,
> likewise only the W variants are available (for the whole Win32 API).
> The w32api headers do things like:
> WINBASEAPI HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR);
> WINBASEAPI HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR);
> #ifdef UNICODE
> #define CreateSemaphore CreateSemaphoreW
> #define CreateSemaphore CreateSemaphoreA
> AFAICS, the mingw-w64 headers do something equivalent.
> For Windows CE, UNICODE is always defined, so uses of CreateSemaphore
> end up calling CreateSemaphoreW. Doesn't WinRT always define
> UNICODE similarly? If not, shouldn't it?
Current mingw-w64 solution uses regular GCC build and adds a
compatibility library for building for winrt target. This means that
libgcc is not aware of winrt and is built for regular win32 target.
Also, I think that being explicit about API variant we use is a good
thing. UNICODE macro may be useful for stuff that has any reason to be
changed by a switch, which is not the case here, IMO.