Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

2013-09-18 Thread Jacek Caban
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
 available.

 libgcc/Changelog:
 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
 #else
 #define CreateSemaphore CreateSemaphoreA
 #endif

 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.

Jacek



Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

2013-09-17 Thread Jacek Caban
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
available.

libgcc/Changelog:
config/i386/gthr-win32.c: CreateSemaphoreW instead of CreateSemaphoreA.
config/i386/gthr-win32.h: Likewise.



Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

2013-09-17 Thread Kai Tietz
2013/9/17 Jacek Caban cja...@gmail.com:
 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
 available.

 libgcc/Changelog:
 config/i386/gthr-win32.c: CreateSemaphoreW instead of CreateSemaphoreA.
 config/i386/gthr-win32.h: Likewise.


Please attach (or inline) patch.

Thanks,
Kai


Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

2013-09-17 Thread Jacek Caban
On 09/17/13 13:41, Kai Tietz wrote:
 2013/9/17 Jacek Caban cja...@gmail.com:
 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
 available.

 libgcc/Changelog:
 config/i386/gthr-win32.c: CreateSemaphoreW instead of CreateSemaphoreA.
 config/i386/gthr-win32.h: Likewise.

 Please attach (or inline) patch.

It's attached now, sorry.

Jacek

commit eea3738e6103da1d1bc391b99734c93737d292a4
Author: Jacek Caban ja...@codeweavers.com
Date:   Tue May 7 17:22:01 2013 +0200

Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

libgcc/Changelog:
config/i386/gthr-win32.c: CreateSemaphoreW instead of CreateSemaphoreA.
config/i386/gthr-win32.h: Likewise.

diff --git a/libgcc/config/i386/gthr-win32.c b/libgcc/config/i386/gthr-win32.c
index f6f661a..f323031 100644
--- a/libgcc/config/i386/gthr-win32.c
+++ b/libgcc/config/i386/gthr-win32.c
@@ -147,7 +147,7 @@ void
 __gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
 {
   mutex-counter = -1;
-  mutex-sema = CreateSemaphore (NULL, 0, 65535, NULL);
+  mutex-sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
 }
 
 void
@@ -195,7 +195,7 @@ __gthr_win32_recursive_mutex_init_function 
(__gthread_recursive_mutex_t *mutex)
   mutex-counter = -1;
   mutex-depth = 0;
   mutex-owner = 0;
-  mutex-sema = CreateSemaphore (NULL, 0, 65535, NULL);
+  mutex-sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
 }
 
 int
diff --git a/libgcc/config/i386/gthr-win32.h b/libgcc/config/i386/gthr-win32.h
index d2e729a..1e437fc 100644
--- a/libgcc/config/i386/gthr-win32.h
+++ b/libgcc/config/i386/gthr-win32.h
@@ -635,7 +635,7 @@ static inline void
 __gthread_mutex_init_function (__gthread_mutex_t *__mutex)
 {
   __mutex-counter = -1;
-  __mutex-sema = CreateSemaphore (NULL, 0, 65535, NULL);
+  __mutex-sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
 }
 
 static inline void
@@ -697,7 +697,7 @@ __gthread_recursive_mutex_init_function 
(__gthread_recursive_mutex_t *__mutex)
   __mutex-counter = -1;
   __mutex-depth = 0;
   __mutex-owner = 0;
-  __mutex-sema = CreateSemaphore (NULL, 0, 65535, NULL);
+  __mutex-sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
 }
 
 static inline int


Re: Use CreateSemaphoreW instead of CreateSemaphoreA in libgcc.

2013-09-17 Thread Kai Tietz
Hi Jacek,

I applied patch at rev. 202648 with following ChangeLog

2013-09-17  Jacek Caban

* config/i386/gthr-win32.c: CreateSemaphoreW instead of
CreateSemaphoreA.
* config/i386/gthr-win32.h: Likewise.

The wide-variant is in general ok due we don't support any windows-OS
anymore, which doesn't support wide API.

Thanks,
Kai