Re: [Boost-bugs] [Boost C++ Libraries] #4217: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303 (experimental) (GCC) compiling error.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4217: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303 (experimental) (GCC) compiling error.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-24 13:54:44


#4217: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303
(experimental) (GCC) compiling error.
--------------------------+-------------------------------------------------
 Reporter: anonymous | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: thread
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
Changes (by feiyunw@…):

 * cc: feiyunw@… (added)

Comment:

 I got compile-time warnings with ogre-1.7.1 and boost-1.43.0 thread:

 {{{
 [ 0%] Building CXX object
 OgreMain/CMakeFiles/OgreMain.dir/src/OgreAlignedAllocator.cpp.obj
 cd OgreMain && C:\MinGW\bin\g++.exe -DOgreMain_EXPORTS
 -D_WIN32_WINNT=0x0500 -DBOOST_ALL_NO_LIB -DOGRE_NONCLIENT_BUILD
 -DFREEIMAGE_LIB -D_MT -D_USRDLL -O3 -DNDEBUG
 -ID:\prj\ogre\ogre-1.7\OgreMain\include -I..\include
 -ID:\prj\ogre\ogre-1.7\Dependencies\include
 -ID:\prj\ogre\ogre-1.7\Dependencies\include\OIS
 -ID:\prj\ogre\ogre-1.7\Dependencies\include\Cg
 -IC:\PROGRA~1\MI21AE~1\Include -IC:\boost\include\boost-1_43
 -ID:\prj\ogre\ogre-1.7\OgreMain\include\WIN32
 -ID:\prj\ogre\ogre-1.7\OgreMain\src\nedmalloc -msse -o
 CMakeFiles\OgreMain.dir\src\OgreAlignedAllocator.cpp.obj -c
 D:\prj\ogre\ogre-1.7\OgreMain\src\OgreAlignedAllocator.cpp
 In file included from C:\boost\include\boost-
 1_43/boost/thread/win32/thread_heap_alloc.hpp:8:0,
                  from C:\boost\include\boost-
 1_43/boost/thread/detail/thread_heap_alloc.hpp:15,
                  from C:\boost\include\boost-1_43/boost/thread/tss.hpp:10,
                  from
 D:\prj\ogre\ogre-1.7\OgreMain\include/Threading/OgreThreadHeadersBoost.h:29,
                  from
 D:\prj\ogre\ogre-1.7\OgreMain\include/Threading/OgreThreadHeaders.h:30,
                  from
 D:\prj\ogre\ogre-1.7\OgreMain\include/OgreStdHeaders.h:110,
                  from
 D:\prj\ogre\ogre-1.7\OgreMain\include/OgrePrerequisites.h:315,
                  from
 D:\prj\ogre\ogre-1.7\OgreMain\src\OgreAlignedAllocator.cpp:30:
 C:\boost\include\boost-
 1_43/boost/thread/win32/thread_primitives.hpp:123:73: warning: declaration
 of 'void boost::detail::win32::Sleep(long unsigned int)' with C language
 linkage
 C:\boost\include\boost-1_43/boost/smart_ptr/detail/yield_k.hpp:58:29:
 warning: conflicts with previous declaration 'void
 boost::detail::Sleep(unsigned int)'
 }}}

 My environment is Windows XP (Chinese version, 32bit)/MinGW/g++-4.5.0.
 The reason is that Sleep() parameter type mismatches.
 In boost/thread/win32/thread_primitives.hpp:

 {{{
 namespace boost
 {
     namespace detail
     {
         namespace win32
         { ...
             extern "C"
             { ...
                 __declspec(dllimport) void __stdcall Sleep(unsigned long);
 }}}

 while in boost/smart_ptr/detail/yield_k.hpp:

 {{{
 namespace boost
 {
 namespace detail
 {
 #if !defined( BOOST_USE_WINDOWS_H )
   extern "C" void __stdcall Sleep( unsigned ms );
 #endif
 }}}

 It looks like "extern C" modifier will make the function ignore namespace
 declaration.
 This makes sense as the function is defined in another module where we
 can't export namespace constraints.
 We should correct the parameter type to stop the compiler warnings.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4217#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC