[cfe-dev] Clang inconsistency with gcc on Windows

Edward Diener eldlistmailingz at tropicsoft.com
Sun May 31 10:48:24 PDT 2015


Compiling some Boost library code the latest clang has produced an 
inconsistency with gcc on Windows that is making it impossible to build 
Boost libraries successfully.

The code in question, where clang is given an error:

> clang-linux.compile.c++.without-pth ..\..\..\bin.v2\libs\context\build\clang-linux-3.7.0\debug\threading-multi\windows\stack_traits.obj
> In file included from ..\..\..\libs\context\src\windows\stack_traits.cpp:24:
> In file included from ..\..\..\boost/thread.hpp:13:
> In file included from ..\..\..\boost/thread/thread.hpp:12:
> In file included from ..\..\..\boost/thread/thread_only.hpp:15:
> In file included from ..\..\..\boost/thread/win32/thread_data.hpp:10:
> In file included from ..\..\..\boost/thread/thread_time.hpp:10:
> In file included from ..\..\..\boost/date_time/microsec_time_clock.hpp:23:
> ..\..\..\boost/date_time/filetime_functions.hpp:57:46: error: conflicting types for 'GetSystemTimeAsFileTime'
>         __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime);
>                                              ^
> /mingw/include\winbase.h:1397:24: note: previous declaration is here
> WINBASEAPI void WINAPI GetSystemTimeAsFileTime(LPFILETIME);
                          ^

and more of the same in many places building Boost libraries with clang.

This is with the latest clang, which I build with mingw/gcc-4.8.1 on 
Windows.

With gcc-4.8.1:

> gcc.compile.c++ ..\..\..\bin.v2\libs\context\build\gcc-mingw-4.8.1\debug\threading-multi\windows\stack_traits.o

With gcc-4.9.2

> gcc.compile.c++ ..\..\..\bin.v2\libs\context\build\gcc-mingw-4.9.2\debug\threading-multi\windows\stack_traits.o

This is happening extensively in Boost code which uses the Windows API 
when compiling under Windows.

I do not know what WINBASEAPI is supposed to resove to under mingw, but 
clearly it should not be different for gcc and clang under Windows and 
gcc has no problems with this.









More information about the cfe-dev mailing list