[Boost-bugs] [Boost C++ Libraries] #13286: warning C4141: 'dllexport': used more than once

Subject: [Boost-bugs] [Boost C++ Libraries] #13286: warning C4141: 'dllexport': used more than once
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-04 21:03:18


#13286: warning C4141: 'dllexport': used more than once
------------------------------+---------------------------
 Reporter: tsondergaard@… | Owner: Robert Ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------
 The following warnings are emitted by Visual Studio 2017 when using
 boost/serialization as a shared library (and defining BOOST_ALL_DYN_LINK
 when using the library):

 {{{
 C:\...\boost\include\boost-1_65_1\boost/archive/codecvt_null.hpp(68):
 warning C4141: 'dllexport': used more than once
 C:\...\boost\include\boost-1_65_1\boost/archive/codecvt_null.hpp(78):
 warning C4141: 'dllexport': used more than once
 C:\...\boost\include\boost-1_65_1\boost/serialization/singleton.hpp(94):
 warning C4141: 'dllexport': used more than once
 }}}

 The problem is use of BOOST_*_DECL and BOOST_DLLEXPORT at the same time.
 Removing the BOOST_DLLEXPORT macro from those lines as done in the
 following patch fixes the problem.

 {{{
 diff --git a/boost/include/boost-1_65_1/boost/archive/codecvt_null.hpp
 b/boost/include/boost-1_65_1/boost/archive/codecvt_null.hpp
 index 7bce2b9b..332ae9f9 100644
 --- a/boost/include/boost-1_65_1/boost/archive/codecvt_null.hpp
 +++ b/boost/include/boost-1_65_1/boost/archive/codecvt_null.hpp
 @@ -65,7 +65,7 @@ public:
  template<>
  class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> : public
 std::codecvt<wchar_t, char, std::mbstate_t>
  {
 - virtual BOOST_WARCHIVE_DECL BOOST_DLLEXPORT std::codecvt_base::result
 + virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
      do_out(
          std::mbstate_t & state,
          const wchar_t * first1,
 @@ -75,7 +75,7 @@ class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> :
 public std::codecvt<wchar_t,
          char * last2,
          char * & next2
      ) const BOOST_USED;
 - virtual BOOST_WARCHIVE_DECL BOOST_DLLEXPORT std::codecvt_base::result
 + virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
      do_in(
          std::mbstate_t & state,
          const char * first1,
 diff --git a/boost/include/boost-1_65_1/boost/serialization/singleton.hpp
 b/boost/include/boost-1_65_1/boost/serialization/singleton.hpp
 index b50afedb..b9e470fa 100644
 --- a/boost/include/boost-1_65_1/boost/serialization/singleton.hpp
 +++ b/boost/include/boost-1_65_1/boost/serialization/singleton.hpp
 @@ -91,7 +91,7 @@ class BOOST_SYMBOL_VISIBLE singleton_module :
      public boost::noncopyable
  {
  private:
 - BOOST_SERIALIZATION_DECL BOOST_DLLEXPORT static bool & get_lock()
 BOOST_USED;
 + BOOST_SERIALIZATION_DECL static bool & get_lock() BOOST_USED;
  public:
      BOOST_DLLEXPORT static void lock(){
          get_lock() = true;
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13286>
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-11-04 21:09:10 UTC