Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2008-03-19 13:25:15


Author: anthonyw
Date: 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
New Revision: 43730
URL: http://svn.boost.org/trac/boost/changeset/43730

Log:
Removed some warnings: those from issue #1640 and others
Text files modified:
   trunk/boost/thread/detail/move.hpp | 2
   trunk/boost/thread/pthread/shared_mutex.hpp | 49 +++++++++++++++++
   trunk/boost/thread/pthread/thread.hpp | 17 +++++
   trunk/boost/thread/pthread/thread_data.hpp | 1
   trunk/boost/thread/win32/basic_timed_mutex.hpp | 22 +++++++
   trunk/boost/thread/win32/condition_variable.hpp | 13 +++
   trunk/boost/thread/win32/once.hpp | 2
   trunk/boost/thread/win32/shared_mutex.hpp | 114 +++++++++++++++++++++++++++++++++++++++
   trunk/boost/thread/win32/thread.hpp | 19 +++++-
   trunk/libs/thread/src/pthread/thread.cpp | 2
   trunk/libs/thread/src/win32/tss_pe.cpp | 9 ++
   trunk/libs/thread/test/condition_test_common.hpp | 2
   trunk/libs/thread/test/shared_mutex_locking_thread.hpp | 8 ++
   trunk/libs/thread/test/test_condition.cpp | 3 +
   trunk/libs/thread/test/test_shared_mutex_part_2.cpp | 4 +
   trunk/libs/thread/test/test_tss.cpp | 2
   trunk/libs/thread/test/util.inl | 5 +
   17 files changed, 261 insertions(+), 13 deletions(-)

Modified: trunk/boost/thread/detail/move.hpp
==============================================================================
--- trunk/boost/thread/detail/move.hpp (original)
+++ trunk/boost/thread/detail/move.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -22,6 +22,8 @@
             {
                 return &t;
             }
+ private:
+ void operator=(thread_move_t&);
         };
     }
     

Modified: trunk/boost/thread/pthread/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/shared_mutex.hpp (original)
+++ trunk/boost/thread/pthread/shared_mutex.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -57,7 +57,14 @@
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(!state.exclusive && !state.exclusive_waiting_blocked)
                 {
@@ -89,7 +96,14 @@
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(!state.exclusive && !state.exclusive_waiting_blocked)
                 {
@@ -130,7 +144,14 @@
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(state.shared_count || state.exclusive)
                 {
@@ -150,7 +171,14 @@
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(state.shared_count || state.exclusive)
                 {
@@ -196,7 +224,14 @@
         {
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(!state.exclusive && !state.exclusive_waiting_blocked && !state.upgrade)
                 {
@@ -213,7 +248,14 @@
         {
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(!state.exclusive && !state.exclusive_waiting_blocked && !state.upgrade)
                 {
@@ -262,7 +304,14 @@
             boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
             --state.shared_count;
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 if(!state.shared_count)
                 {

Modified: trunk/boost/thread/pthread/thread.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread.hpp (original)
+++ trunk/boost/thread/pthread/thread.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -22,6 +22,12 @@
 #include <boost/shared_ptr.hpp>
 #include "thread_data.hpp"
 #include <boost/bind.hpp>
+#include <stdlib.h>
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
 
 namespace boost
 {
@@ -319,7 +325,7 @@
         }
     }
 
- class BOOST_THREAD_DECL thread_group : private noncopyable
+ class BOOST_THREAD_DECL thread_group
     {
     public:
         thread_group();
@@ -330,13 +336,20 @@
         void remove_thread(thread* thrd);
         void join_all();
         void interrupt_all();
- int size() const;
+ size_t size() const;
 
     private:
+ thread_group(thread_group&);
+ void operator=(thread_group&);
+
         std::list<thread*> m_threads;
         mutex m_mutex;
     };
 } // namespace boost
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 
 #endif

Modified: trunk/boost/thread/pthread/thread_data.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread_data.hpp (original)
+++ trunk/boost/thread/pthread/thread_data.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -72,6 +72,7 @@
                 }
             }
             
+ void operator=(interruption_checker&);
         public:
             explicit interruption_checker(pthread_cond_t* cond):
                 thread_info(detail::get_current_thread_data())

Modified: trunk/boost/thread/win32/basic_timed_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/basic_timed_mutex.hpp (original)
+++ trunk/boost/thread/win32/basic_timed_mutex.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -33,7 +33,14 @@
 
             void destroy()
             {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4312)
+#endif
                 void* const old_event=BOOST_INTERLOCKED_EXCHANGE_POINTER(&event,0);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
                 if(old_event)
                 {
                     win32::CloseHandle(old_event);
@@ -64,7 +71,14 @@
             bool timed_lock(::boost::system_time const& wait_until)
             {
                 long old_count=active_count;
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                 while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
                 {
                     long const current_count=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&active_count,(old_count+1)|lock_flag_value,old_count);
                     if(current_count==old_count)
@@ -139,7 +153,15 @@
                 if(!current_event)
                 {
                     void* const new_event=win32::create_anonymous_event(win32::auto_reset_event,win32::event_initially_reset);
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4311)
+#pragma warning(disable:4312)
+#endif
                     void* const old_event=BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&event,new_event,0);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
                     if(old_event!=0)
                     {
                         win32::CloseHandle(new_event);

Modified: trunk/boost/thread/win32/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/win32/condition_variable.hpp (original)
+++ trunk/boost/thread/win32/condition_variable.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -55,10 +55,17 @@
                 }
                 else
                 {
- active_generation_count=(last_active_entry-generations)+1;
+ active_generation_count=unsigned(last_active_entry-generations)+1;
                 }
-
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4996)
+#endif
                 std::copy_backward(generations,generations+active_generation_count-1,generations+active_generation_count);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
                 generations[0]=list_entry();
             }
 
@@ -108,6 +115,8 @@
                     }
                     
                 }
+ private:
+ void operator=(relocker&);
             };
             
 

Modified: trunk/boost/thread/win32/once.hpp
==============================================================================
--- trunk/boost/thread/win32/once.hpp (original)
+++ trunk/boost/thread/win32/once.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -46,6 +46,8 @@
             {
                 BOOST_VERIFY(win32::ReleaseMutex(mutex_handle)!=0);
             }
+ private:
+ void operator=(win32_mutex_scoped_lock&);
         };
 
 #ifdef BOOST_NO_ANSI_APIS

Modified: trunk/boost/thread/win32/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/shared_mutex.hpp (original)
+++ trunk/boost/thread/win32/shared_mutex.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -1,7 +1,7 @@
 #ifndef BOOST_THREAD_WIN32_SHARED_MUTEX_HPP
 #define BOOST_THREAD_WIN32_SHARED_MUTEX_HPP
 
-// (C) Copyright 2006-7 Anthony Williams
+// (C) Copyright 2006-8 Anthony Williams
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -104,7 +104,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             return !(old_state.exclusive| old_state.exclusive_waiting_blocked);
         }
 
@@ -115,7 +122,14 @@
 
         bool timed_lock_shared(boost::system_time const& wait_until)
         {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 state_data old_state=state;
                 do
@@ -137,7 +151,14 @@
                     }
                     old_state=current_state;
                 }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                 while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 
                 if(!(old_state.exclusive| old_state.exclusive_waiting_blocked))
                 {
@@ -169,7 +190,14 @@
                         }
                         old_state=current_state;
                     }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                     while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 
                     if(!(old_state.exclusive| old_state.exclusive_waiting_blocked))
                     {
@@ -226,7 +254,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
         }
 
         void lock()
@@ -236,7 +271,14 @@
 
         bool timed_lock(boost::system_time const& wait_until)
         {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 state_data old_state=state;
 
@@ -260,7 +302,14 @@
                     }
                     old_state=current_state;
                 }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                 while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 
                 if(!old_state.shared_count && !old_state.exclusive)
                 {
@@ -291,7 +340,14 @@
                         }
                         old_state=current_state;
                     }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                     while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
                     if(!old_state.shared_count && !old_state.exclusive)
                     {
                         return true;
@@ -323,13 +379,27 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             release_waiters(old_state);
         }
 
         void lock_upgrade()
         {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             {
                 state_data old_state=state;
                 do
@@ -352,7 +422,14 @@
                     }
                     old_state=current_state;
                 }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
                 while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 
                 if(!(old_state.exclusive|| old_state.exclusive_waiting_blocked|| old_state.upgrade))
                 {
@@ -393,7 +470,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
         }
 
         void unlock_upgrade_and_lock()
@@ -421,7 +505,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
         }
 
         void unlock_and_lock_upgrade()
@@ -447,7 +538,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             release_waiters(old_state);
         }
         
@@ -473,7 +571,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             release_waiters(old_state);
         }
         
@@ -498,7 +603,14 @@
                 }
                 old_state=current_state;
             }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
             while(true);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
             release_waiters(old_state);
         }
         

Modified: trunk/boost/thread/win32/thread.hpp
==============================================================================
--- trunk/boost/thread/win32/thread.hpp (original)
+++ trunk/boost/thread/win32/thread.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -21,6 +21,13 @@
 #include <boost/ref.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/bind.hpp>
+#include <stdlib.h>
+#include <memory>
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
 
 namespace boost
 {
@@ -476,9 +483,9 @@
         thread* create_thread(F threadfunc)
         {
             boost::lock_guard<mutex> guard(m);
- thread* const new_thread=new thread(threadfunc);
- threads.push_back(new_thread);
- return new_thread;
+ std::auto_ptr<thread> new_thread(new thread(threadfunc));
+ threads.push_back(new_thread.get());
+ return new_thread.release();
         }
         
         void add_thread(thread* thrd)
@@ -524,7 +531,7 @@
             }
         }
         
- int size() const
+ size_t size() const
         {
             boost::lock_guard<mutex> guard(m);
             return threads.size();
@@ -536,4 +543,8 @@
     };
 }
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 #endif

Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -683,7 +683,7 @@
     }
         
 
- int thread_group::size() const
+ size_t thread_group::size() const
     {
         return m_threads.size();
     }

Modified: trunk/libs/thread/src/win32/tss_pe.cpp
==============================================================================
--- trunk/libs/thread/src/win32/tss_pe.cpp (original)
+++ trunk/libs/thread/src/win32/tss_pe.cpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -164,6 +164,10 @@
         #endif
 #endif
 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4189)
+#endif
         PVAPI on_tls_prepare(void)
         {
             //The following line has an important side effect:
@@ -201,6 +205,9 @@
 
             return INIRETSUCCESS;
         }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 
         PVAPI on_process_init(void)
         {
@@ -228,7 +235,7 @@
             return INIRETSUCCESS;
         }
 
- void NTAPI on_tls_callback(HINSTANCE h, DWORD dwReason, PVOID pv)
+ void NTAPI on_tls_callback(HINSTANCE /*h*/, DWORD dwReason, PVOID /*pv*/)
         {
             switch (dwReason)
             {

Modified: trunk/libs/thread/test/condition_test_common.hpp
==============================================================================
--- trunk/libs/thread/test/condition_test_common.hpp (original)
+++ trunk/libs/thread/test/condition_test_common.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -34,6 +34,8 @@
         {
             return flag;
         }
+ private:
+ void operator=(check_flag&);
     };
 
         

Modified: trunk/libs/thread/test/shared_mutex_locking_thread.hpp
==============================================================================
--- trunk/libs/thread/test/shared_mutex_locking_thread.hpp (original)
+++ trunk/libs/thread/test/shared_mutex_locking_thread.hpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -1,6 +1,12 @@
 #ifndef SHARED_MUTEX_LOCKING_THREAD_HPP
 #define SHARED_MUTEX_LOCKING_THREAD_HPP
 
+// (C) Copyright 2008 Anthony Williams
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 #include <boost/thread/shared_mutex.hpp>
@@ -56,6 +62,8 @@
             --simultaneous_running_count;
         }
     }
+private:
+ void operator=(locking_thread&);
 };
 
 

Modified: trunk/libs/thread/test/test_condition.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition.cpp (original)
+++ trunk/libs/thread/test/test_condition.cpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -43,6 +43,9 @@
 
     int& _var;
     int _val;
+private:
+ void operator=(cond_predicate&);
+
 };
 
 void condition_test_waits(condition_test_data* data)

Modified: trunk/libs/thread/test/test_shared_mutex_part_2.cpp
==============================================================================
--- trunk/libs/thread/test/test_shared_mutex_part_2.cpp (original)
+++ trunk/libs/thread/test/test_shared_mutex_part_2.cpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -116,6 +116,8 @@
         boost::mutex& unblocked_mutex;
         unsigned& unblocked_count;
         
+ void operator=(simple_writing_thread&);
+
     public:
         simple_writing_thread(boost::shared_mutex& rwm_,
                               boost::mutex& finish_mutex_,
@@ -182,6 +184,8 @@
         boost::mutex& unblocked_mutex;
         unsigned& unblocked_count;
         
+ void operator=(simple_reading_thread&);
+
     public:
         simple_reading_thread(boost::shared_mutex& rwm_,
                               boost::mutex& finish_mutex_,

Modified: trunk/libs/thread/test/test_tss.cpp
==============================================================================
--- trunk/libs/thread/test/test_tss.cpp (original)
+++ trunk/libs/thread/test/test_tss.cpp 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -66,7 +66,7 @@
 #if defined(BOOST_THREAD_PLATFORM_WIN32)
     typedef HANDLE native_thread_t;
 
- DWORD WINAPI test_tss_thread_native(LPVOID lpParameter)
+ DWORD WINAPI test_tss_thread_native(LPVOID /*lpParameter*/)
     {
         test_tss_thread();
         return 0;

Modified: trunk/libs/thread/test/util.inl
==============================================================================
--- trunk/libs/thread/test/util.inl (original)
+++ trunk/libs/thread/test/util.inl 2008-03-19 13:25:13 EDT (Wed, 19 Mar 2008)
@@ -1,6 +1,6 @@
 // Copyright (C) 2001-2003
 // William E. Kempf
-// Copyright (C) 2007 Anthony Williams
+// Copyright (C) 2007-8 Anthony Williams
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -123,6 +123,7 @@
 private:
     F func;
     execution_monitor& monitor;
+ void operator=(indirect_adapter&);
 };
 
 template <typename F>
@@ -165,6 +166,8 @@
     void operator()() const { (param.*func)(); }
 
 private:
+ void operator=(thread_member_binder&);
+
     R (T::*func)();
     T& param;
 };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk