<div dir="rtl"><div dir="ltr">The error reported is with mingw 5.1.0 which is failry new. </div><div dir="ltr">Maybe previous clangs were ok using previous versions of the mingw-w64 headers?</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-07-22 0:39 GMT+03:00 Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Edward,<br>
<br>
I'm using this code to reproduce the issue you're seeing:<br>
<br>
  extern "C" void sleep(unsigned ms);<br>
  void f() {<br>
    sleep(1000);<br>
  }<br>
  extern "C" __declspec(dllimport) void sleep(unsigned ms);<br>
<br>
Compiling with "clang -target i686-pc-win32 -c a.cc" produces the<br>
error you describe.<br>
<br>
This produces an error both with both 3.5, 3.6 and trunk for me. Is it<br>
possible that something has changed in your code, or that something is<br>
getting #ifdef'ed differently based on the clang version?<br>
<br>
The problem here is that Clang doesn't want to change the<br>
"dllimport"-ness of sleep() after it has been called. If you try to<br>
add the dllimport attribute before sleep() has been used, Clang will<br>
just warn.<br>
<br>
 - Hans<br>
<br>
On Tue, Jul 21, 2015 at 12:36 PM, Edward Diener<br>
<<a href="mailto:eldlistmailingz@tropicsoft.com">eldlistmailingz@tropicsoft.com</a>> wrote:<br>
> In the latest clang built from source, if a function is mismatched as to a<br>
> difference in dllimport attributes clang produces an error. As in:<br>
><br>
> C:\Utilities\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\i686-w64-mingw32\include\synchapi.h:127:26:<br>
> error: redeclaration of 'Sleep' cannot add 'dllimport' attribute<br>
>   WINBASEAPI VOID WINAPI Sleep (DWORD dwMilliseconds);<br>
>                          ^<br>
> ..\..\..\boost/smart_ptr/detail/yield_k.hpp:67:29: note: previous<br>
> declaration is here<br>
>   extern "C" void __stdcall Sleep( unsigned long ms );<br>
><br>
> Changing the latter to:<br>
><br>
>   extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms );<br>
><br>
> fixes the problem for clang.<br>
><br>
> Earlier versions of clang ( 3.4.1, 3.5.2, 3.6.1 ) did not have this problem.<br>
> Is there a __has_feature or __has_extension that I can use to test this<br>
> change in the latest clang ? The previous versions are also happy with the<br>
> __declspec(dllimport) added in the declaration so even without a<br>
> __has_feature or __has_extension I can just test for clang on Windows, but I<br>
> like to be as precise as possible in Boost code.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>