On 8/10/2013 11:47, G M wrote:
> Hi
> 
> Just to correct my previous message, the alternative stralign.h I
> found doesn't work for me after all when building Ninja, I made a mistake
> building it before to think it did work.
> 
> So the diff I provided for further info in my previous message may not be
> that useful
> 
> So to recap, I'm using stralign.h from here:
> http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/seh/
> that fails on stralign.h:
> 
> #ifndef __CRT__NO_INLINE
>   __CRT_INLINE PUWSTR_C ua_wcschr(PCUWSTR String,WCHAR Character) {
>     if(WSTR_ALIGNED(String)) return ::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);
>     return (PUWSTR_C)uaw_wcsrchr(String,Character);
>   }
> 
> I added the :: characters above to make Ninja compile, but I doubt that is
> the right fix even it works or appears to.
> 
> If there exists a "latest" release of these files, please give me a full
> link to where and I'll try them and report back.
> 

As suggested earlier, it is on SVN, if you bothered to ask google:
<http://svn.code.sf.net/p/mingw-w64/code/trunk/mingw-w64-headers/include/stralign.h>

> Alternatively, if anyone else want's to try to build Ninja on github with
> libcxx and clang++ using the same mingw's C headers I am using,
> then they should see the same conflict I am seeing with libcxx's headers
> and mingw's stralign.h that I'd like to fix.
> 
> note: candidate function
>   _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
>                                  ^
> /libcxx/include\cwchar:180:49: note: candidate function
> inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s,
> wchar_t __c) {return ::wcschr(__s, __c);}
>                                                 ^
> In file included from src\build.cc:33:
> In file included from src/subprocess.h:25:
> In file included from
> c:\mingw\bin\..\lib\clang\3.4\../../../x86_64-w64-mingw32/include\windows.h:114:
> c:\mingw\bin\..\lib\clang\3.4\../../../x86_64-w64-mingw32/include\stralign.h:120:37:
> error: call to 'wcsrchr' is ambiguous
>     if(WSTR_ALIGNED(String)) return wcsrchr((PCWSTR)String,Character);
>                                     ^~~~~~~
> c:\mingw\bin\..\lib\clang\3.4\../../../x86_64-w64-mingw32/include\wchar.h:851:34:
> note: candidate function
>   _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
>                                  ^

Likely a conflict with libcxx, libgcxx cwchar too has cwchar defined.

I cannot reproduce the error with GCC, please write a minimalist test
case to demonstrate the error.

GCC test:
#include <string>
#include <cwchar>
#include <windows.h>

int f(){
  ua_wcsrchr(0,0);
  ua_wcsrchr((const wchar_t *)0,0);
  ua_wcsrchr((const wchar_t __unaligned *)0,0);
  return 0;
}


Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to