Opened 7 years ago

Closed 5 years ago

#11338 closed Support Requests (obsolete)

mingw warnings

Reported by: victor bombi <sonoro@…> Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc: Andrey.Semashev@…

Description

Since a long time ago I get the following warning (and others similar to this)

C:/SupercolliderRepos/scfork/supercollider/external_libraries/boost/boost/detail/winapi/synchronization.hpp:195:66: warning: declaration of 'void* boost::detail::winapi::CreateEventA(boost::detail::winapi::_SECURITY_ATTRIBUTES*, boost::detail::winapi ::BOOL_, boost::detail::winapi::BOOL_, boost::detail::winapi::LPCSTR_)' with C language linkage [enabled by default]

CreateEventA(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCSTR_);

In file included from C:/SupercolliderRepos/scfork/supercollider/external_libraries/boost/boost/thread/win32/shared_mutex.hpp :13:0,

from C:/SupercolliderRepos/scfork/supercollider/external_libraries/boost/boost/thread/shared_mutex.hpp:18, from C:/SupercolliderRepos/scfork/supercollider/external_libraries/nova-tt/nova-tt/rw_mutex.hpp:27, from C:/SupercolliderRepos/scfork/supercollider/server/supernova/./utilities/named_hash_entry.hpp:27, from C:/SupercolliderRepos/scfork/supercollider/server/supernova/./server/synth_definition.hpp:29, from C:/SupercolliderRepos/scfork/supercollider/server/supernova/./server/node_types.hpp:28, from C:/SupercolliderRepos/scfork/supercollider/server/supernova/./server/synth.hpp:27, from C:\SupercolliderRepos\scfork\supercollider\server\supernova\server\dsp_thread_queue_node.hpp:27, from C:\SupercolliderRepos\scfork\supercollider\server\supernova\server\node_graph.hpp:26, from C:\SupercolliderRepos\scfork\supercollider\server\supernova\server\server.hpp:26, from C:\SupercolliderRepos\scfork\supercollider\server\supernova\server\main.cpp:28:

C:/SupercolliderRepos/scfork/supercollider/external_libraries/boost/boost/thread/win32/thread_primitives.hpp:166:55: warning:

conflicts with previous declaration 'void* boost::detail::win32::CreateEventA(boost::detail::win32::_SECURITY_ATTRIBUTES*, i

nt, int, const char*)' [enabled by default]

declspec(dllimport) void* stdcall CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*);

Change History (12)

comment:1 by John Maddock, 7 years ago

Component: Nonewinapi
Owner: set to Andrey Semashev

comment:2 by Andrey Semashev, 7 years ago

Component: winapithread
Owner: changed from Andrey Semashev to viboes

IIRC, Boost.Thread developers were planning to port to the Boost.WinAPI declarations at some point. This would remove the discrepancies between the declarations and, I think, this would be the right solution.

comment:3 by Andrey Semashev, 7 years ago

Cc: Andrey.Semashev@… added

comment:4 by viboes, 7 years ago

I have no access to a windows environment.

I could create a branch and do my best to port to Boost.WinAPI if someone is ready to test it.

I would also accept any working patch.

comment:5 by Edward Diener, 7 years ago

I can test the changes made to Boost.WinAPI on Windows 7 and/or 8.1 using VC++ ( 8 through 12 ), gcc ( 4.3 through 4.9.2 ), and the latest clang. Just tell me what the git branch is and I will test it for you when you are finished with it.

comment:6 by viboes, 7 years ago

Thanks, I will post it here.

comment:7 by Edward Diener, 7 years ago

My clang bug report at https://llvm.org/bugs/show_bug.cgi?id=23722 came back with:

The problem is that the two function declarations have different parameter types. The windows.h version takes ::_FILETIME*, whereas the boost version takes boost::detail::winapi::_FILETIME*. Because they're 'extern "C"' functions, they are redeclarations of the same function, and are ill-formed because they have different types.

It looks like the only viable solution which will satisfy clang, and the C++ standard, is along the lines of what Peter Dimov suggested for all the winapi functionality:

/* at global scope */
  struct FILETIME;
  extern "C" __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME*);

  namespace winapi
  {
     struct FILETIME { ... };

     inline void GetSystemTimeAsFileTime( FILETIME * p )
     {
         ::GetSystemTimeAsFileTime( (::FILETIME*)p );
     }
  } 

and then calling:

  boost::winapi::FILETIME ft;
  boost::winapi::GetSystemTimeAsFileTime(&ft);

is no problem for clang and the C++ standard.

comment:8 by Andrey Semashev, 7 years ago

We'll wait and see if the clang behavior is actually backed by the standard.

I think Boost.Thread needs to be ported to Boost.WinAPI regardless of the clang issue, at least to remove duplication. We can deal with the clang issue in Boost.WinAPI, and once Boost.Thread is ported, the problem will be solved for it as well.

comment:9 by Edward Diener, 7 years ago

The clang explanation is:

[dcl.link]/6: "At most one function with a particular name can have C language linkage. Two declarations for a function with C language linkage with the same function name (ignoring the namespace names that qualify it) that appear in different namespace scopes refer to the same function."

[basic.link]/10: "the types specified by all declarations referring to a given variable or function shall be identical"

So the program is ill-formed because the same function is declared with two different types.

comment:10 by viboes, 7 years ago

Status: newassigned

in reply to:  10 comment:11 by sonoro@…, 7 years ago

Replying to viboes: Is this still alive?

comment:12 by viboes, 5 years ago

Resolution: obsolete
Status: assignedclosed

Closed as Boost.Thread uses now Boost.WinApi

Note: See TracTickets for help on using tickets.