Hmm, using here "wchar_t *" as cast looks wrong.  Actually we should
use anyway PUWSTR_C instead.
Nevertheless we can have here a const/none-const conversion (means
const specifiers for C-runtime function isn't regarded right?).  I
would suggest to introduce a union-cast instead to avoid further
warnings instead.

Regards,
Kai

2017-04-05 15:06 GMT+02:00 Mateusz Mikuła <mati...@gmail.com>:
>  Hmm, somehow Sourcefore has lost track on this thread (you can see
> patch on the mailing list website).
>
> This time sending it as both attachment and text.
>
> From f3febf9542a6664eedc384b0d2bf63411477e141 Mon Sep 17 00:00:00 2001
> From: Mateusz Mikula <mati...@gmail.com>
> Date: Mon, 3 Apr 2017 13:36:36 +0200
> Subject: [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to
> wchar_t *
>
> Clang doesn't allow implicit conversion form 'const wchar_t *' to
> 'wchar_t *'
>
> Signed-off-by: Mateusz Mikula <mati...@gmail.com>
> ---
>  mingw-w64-headers/include/stralign.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mingw-w64-headers/include/stralign.h
> b/mingw-w64-headers/include/stralign.h
> index 9b5637d6..cdb81438 100644
> --- a/mingw-w64-headers/include/stralign.h
> +++ b/mingw-w64-headers/include/stralign.h
> @@ -118,11 +118,11 @@ extern "C" {
>
>  #ifndef __CRT__NO_INLINE
>    __CRT_INLINE PUWSTR_C ua_wcschr(PCUWSTR String,WCHAR Character) {
> -    if(WSTR_ALIGNED(String)) return wcschr((PCWSTR)String,Character);
> +    if(WSTR_ALIGNED(String)) return (wchar_t
> *)wcschr((PCWSTR)String,Character);
>      return (PUWSTR_C)uaw_wcschr(String,Character);
>    }
>    __CRT_INLINE PUWSTR_C ua_wcsrchr(PCUWSTR String,WCHAR Character) {
> -    if(WSTR_ALIGNED(String)) return wcsrchr((PCWSTR)String,Character);
> +    if(WSTR_ALIGNED(String)) return (wchar_t
> *)wcsrchr((PCWSTR)String,Character);
>      return (PUWSTR_C)uaw_wcsrchr(String,Character);
>    }
>  #if defined(__cplusplus) && defined(_WConst_Return)
> --
> 2.12.1
>
>
> ------ Original Message ------
> Subject: Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and
> ua_wcsrchr returns to wchar_t *
> Date: Wed, 5 Apr 2017 14:26:50 +0200
> To: Mingw-w64-public
> From: Kai Tietz
>> Hello Mateusz,
>>
>> could you please re-attach, or simply inline patch to this mail?
>>
>> Thanks in advance,
>> Kai
>>
>> 2017-04-05 14:08 GMT+02:00 Mateusz Mikuła <mati...@gmail.com>:
>>>  Ping, looks like it slipped unnoticed.
>>>
>>>
>>>
>>>
>>> ------ Original Message ------
>>> Subject: [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to
>>> wchar_t *
>>> Date: Mon, 3 Apr 2017 14:01:00 +0200
>>> To: Mingw-w64-public
>>> From: Mateusz Mikuła
>>>> I made another attempt to build libc++ with mingw-w64 and stumbled
>>>> across Clang errors:
>>>>
>>>> |D:\msys64\mingw64\x86_64-w64-mingw32\include\windows.h:114:
>>>> D:\msys64\mingw64\x86_64-w64-mingw32\include\stralign.h:121:37: error:
>>>> cannot initialize return object of type 'PUWSTR_C' (aka 'wchar_t *')
>>>> with an rvalue of type 'const wchar_t *' if(WSTR_ALIGNED(String))
>>>> return wcschr((PCWSTR)String,Character);
>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> D:\msys64\mingw64\x86_64-w64-mingw32\include\stralign.h:125:37: error:
>>>> cannot initialize return object of type 'PUWSTR_C' (aka 'wchar_t *')
>>>> with an rvalue of type 'const wchar_t *' if(WSTR_ALIGNED(String))
>>>> return wcsrchr((PCWSTR)String,Character); You can see here function
>>>> that should return PUWSTR_C (aka ||'wchar_t *') returns ||'const wchar_t 
>>>> *|' instead.
>>>>
>>>> This patch solved error for Clang and caused no errors or warning for GCC.
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Mingw-w64-public mailing list
>>> Mingw-w64-public@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Mingw-w64-public mailing list
>> Mingw-w64-public@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to