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.

From f3febf9542a6664eedc384b0d2bf63411477e141 Mon Sep 17 00:00:00 2001
From: Mateusz Mikula <[email protected]>
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 <[email protected]>
---
 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

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to