diff --git a/example/ba_externallly_locked.cpp b/example/ba_externallly_locked.cpp index d4454ae6..e9387676 100644 --- a/example/ba_externallly_locked.cpp +++ b/example/ba_externallly_locked.cpp @@ -12,6 +12,10 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +#endif + using namespace boost; class BankAccount diff --git a/example/future_fallback_to.cpp b/example/future_fallback_to.cpp index 7301b0ae..7e928eec 100644 --- a/example/future_fallback_to.cpp +++ b/example/future_fallback_to.cpp @@ -21,6 +21,10 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1_ex() { BOOST_THREAD_LOG << "P1" << BOOST_THREAD_END_LOG; diff --git a/example/future_then.cpp b/example/future_then.cpp index eac1540b..17ef3671 100644 --- a/example/future_then.cpp +++ b/example/future_then.cpp @@ -20,6 +20,10 @@ #include #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { BOOST_THREAD_LOG << "P1" << BOOST_THREAD_END_LOG; diff --git a/example/future_unwrap.cpp b/example/future_unwrap.cpp index 4d679d3b..aeed9db9 100644 --- a/example/future_unwrap.cpp +++ b/example/future_unwrap.cpp @@ -20,6 +20,10 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_UNWRAP +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { BOOST_THREAD_LOG << "P1" << BOOST_THREAD_END_LOG; diff --git a/example/future_when_all.cpp b/example/future_when_all.cpp index 48f3e153..52a40e9c 100644 --- a/example/future_when_all.cpp +++ b/example/future_when_all.cpp @@ -21,6 +21,10 @@ #include #if defined BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { BOOST_THREAD_LOG diff --git a/example/lambda_future.cpp b/example/lambda_future.cpp index fd15d448..8d75e16d 100644 --- a/example/lambda_future.cpp +++ b/example/lambda_future.cpp @@ -22,6 +22,9 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \ && ! defined BOOST_NO_CXX11_LAMBDAS && ! (defined BOOST_MSVC && _MSC_VER < 1700) +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif int main() { diff --git a/example/thread_pool.cpp b/example/thread_pool.cpp index af4c0efe..20f66ebd 100644 --- a/example/thread_pool.cpp +++ b/example/thread_pool.cpp @@ -18,6 +18,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + void p1() { BOOST_THREAD_LOG diff --git a/example/user_scheduler.cpp b/example/user_scheduler.cpp index 5ea5863b..78e184b3 100644 --- a/example/user_scheduler.cpp +++ b/example/user_scheduler.cpp @@ -17,6 +17,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + void p1() { BOOST_THREAD_LOG diff --git a/include/boost/thread/detail/config.hpp b/include/boost/thread/detail/config.hpp index 6c4b55c8..ebd73a7e 100644 --- a/include/boost/thread/detail/config.hpp +++ b/include/boost/thread/detail/config.hpp @@ -387,7 +387,7 @@ // provided for backwards compatibility, since this // macro was used for several releases by mistake. -#if defined(BOOST_THREAD_DYN_DLL) && ! defined BOOST_THREAD_DYN_LINK +#if defined(BOOST_THREAD_DYN_DLL) && ! defined(BOOST_THREAD_DYN_LINK) # define BOOST_THREAD_DYN_LINK #endif diff --git a/include/boost/thread/executors/scheduler.hpp b/include/boost/thread/executors/scheduler.hpp index 3120e797..7a4c93ed 100644 --- a/include/boost/thread/executors/scheduler.hpp +++ b/include/boost/thread/executors/scheduler.hpp @@ -16,6 +16,11 @@ #include +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +#endif + namespace boost { namespace executors @@ -267,6 +272,10 @@ namespace boost using executors::scheduler; } +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + #include #endif diff --git a/include/boost/thread/executors/scheduling_adaptor.hpp b/include/boost/thread/executors/scheduling_adaptor.hpp index 2c520d6f..e19c1afc 100644 --- a/include/boost/thread/executors/scheduling_adaptor.hpp +++ b/include/boost/thread/executors/scheduling_adaptor.hpp @@ -10,6 +10,11 @@ #include +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +#endif + namespace boost { namespace executors @@ -49,4 +54,9 @@ namespace executors using executors::scheduling_adaptor; } //end boost + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/thread/executors/serial_executor.hpp b/include/boost/thread/executors/serial_executor.hpp index 6d7ed9be..7973c5d9 100644 --- a/include/boost/thread/executors/serial_executor.hpp +++ b/include/boost/thread/executors/serial_executor.hpp @@ -20,6 +20,11 @@ #include +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +#endif + namespace boost { namespace executors @@ -211,6 +216,10 @@ namespace executors using executors::serial_executor; } +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + #include #endif diff --git a/include/boost/thread/once.hpp b/include/boost/thread/once.hpp index 9fcfb533..22f95139 100644 --- a/include/boost/thread/once.hpp +++ b/include/boost/thread/once.hpp @@ -10,6 +10,12 @@ // http://www.boost.org/LICENSE_1_0.txt) #include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4702) // unreachable code +#endif + #include #if defined(BOOST_THREAD_PLATFORM_WIN32) #include @@ -41,4 +47,8 @@ inline void call_once(Function func,once_flag& flag) #include +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + #endif diff --git a/test/sync/conditions/condition_variable/wait_until_pred_pass.cpp b/test/sync/conditions/condition_variable/wait_until_pred_pass.cpp index 2f4136f7..61639a0b 100644 --- a/test/sync/conditions/condition_variable/wait_until_pred_pass.cpp +++ b/test/sync/conditions/condition_variable/wait_until_pred_pass.cpp @@ -74,6 +74,7 @@ void f() Clock::time_point t0 = Clock::now(); Clock::time_point t = t0 + Clock::duration(250); bool r = cv.wait_until(lk, t, Pred(test2)); + (void)r; Clock::time_point t1 = Clock::now(); if (runs == 0) { diff --git a/test/sync/futures/future/get_or_pass.cpp b/test/sync/futures/future/get_or_pass.cpp index 64409455..7db938d3 100644 --- a/test/sync/futures/future/get_or_pass.cpp +++ b/test/sync/futures/future/get_or_pass.cpp @@ -22,6 +22,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + namespace boost { template diff --git a/test/sync/futures/future/get_pass.cpp b/test/sync/futures/future/get_pass.cpp index 5cd5f810..ec2ccf8b 100644 --- a/test/sync/futures/future/get_pass.cpp +++ b/test/sync/futures/future/get_pass.cpp @@ -32,6 +32,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + namespace boost { template diff --git a/test/sync/futures/future/then_deferred_pass.cpp b/test/sync/futures/future/then_deferred_pass.cpp index 0a7848de..0ea37bd7 100644 --- a/test/sync/futures/future/then_deferred_pass.cpp +++ b/test/sync/futures/future/then_deferred_pass.cpp @@ -21,6 +21,9 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif int p1() { diff --git a/test/sync/futures/future/then_executor_pass.cpp b/test/sync/futures/future/then_executor_pass.cpp index 3c9b9f50..8a98afca 100644 --- a/test/sync/futures/future/then_executor_pass.cpp +++ b/test/sync/futures/future/then_executor_pass.cpp @@ -24,6 +24,9 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif int p1() { diff --git a/test/sync/futures/future/then_pass.cpp b/test/sync/futures/future/then_pass.cpp index d9f9ff7b..12270679 100644 --- a/test/sync/futures/future/then_pass.cpp +++ b/test/sync/futures/future/then_pass.cpp @@ -20,6 +20,9 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif int p1() { diff --git a/test/sync/futures/future/wait_for_pass.cpp b/test/sync/futures/future/wait_for_pass.cpp index 2781ddd3..4b409005 100644 --- a/test/sync/futures/future/wait_for_pass.cpp +++ b/test/sync/futures/future/wait_for_pass.cpp @@ -32,6 +32,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/future/wait_pass.cpp b/test/sync/futures/future/wait_pass.cpp index 10866427..daa9b376 100644 --- a/test/sync/futures/future/wait_pass.cpp +++ b/test/sync/futures/future/wait_pass.cpp @@ -32,6 +32,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/future/wait_until_pass.cpp b/test/sync/futures/future/wait_until_pass.cpp index 63bfbbab..de68e43b 100644 --- a/test/sync/futures/future/wait_until_pass.cpp +++ b/test/sync/futures/future/wait_until_pass.cpp @@ -33,6 +33,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/promise/set_value_const_pass.cpp b/test/sync/futures/promise/set_value_const_pass.cpp index 06b449e1..e4defb91 100644 --- a/test/sync/futures/promise/set_value_const_pass.cpp +++ b/test/sync/futures/promise/set_value_const_pass.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(disable: 4702) // unreachable code +#endif + struct A { A() diff --git a/test/sync/futures/shared_future/then_executor_pass.cpp b/test/sync/futures/shared_future/then_executor_pass.cpp index 5dc86afd..73b42fc8 100644 --- a/test/sync/futures/shared_future/then_executor_pass.cpp +++ b/test/sync/futures/shared_future/then_executor_pass.cpp @@ -23,6 +23,10 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { BOOST_THREAD_LOG << "p1 < " << BOOST_THREAD_END_LOG; diff --git a/test/sync/futures/shared_future/then_pass.cpp b/test/sync/futures/shared_future/then_pass.cpp index b7d95bc6..e7cca062 100644 --- a/test/sync/futures/shared_future/then_pass.cpp +++ b/test/sync/futures/shared_future/then_pass.cpp @@ -20,6 +20,10 @@ #if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { BOOST_THREAD_LOG << "p1 < " << BOOST_THREAD_END_LOG; diff --git a/test/sync/futures/shared_future/wait_for_pass.cpp b/test/sync/futures/shared_future/wait_for_pass.cpp index 96e8d371..395f37ff 100644 --- a/test/sync/futures/shared_future/wait_for_pass.cpp +++ b/test/sync/futures/shared_future/wait_for_pass.cpp @@ -32,6 +32,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/shared_future/wait_pass.cpp b/test/sync/futures/shared_future/wait_pass.cpp index 3e4373b1..d2d1b31f 100644 --- a/test/sync/futures/shared_future/wait_pass.cpp +++ b/test/sync/futures/shared_future/wait_pass.cpp @@ -32,6 +32,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/shared_future/wait_until_pass.cpp b/test/sync/futures/shared_future/wait_until_pass.cpp index 07852dcf..b683c13f 100644 --- a/test/sync/futures/shared_future/wait_until_pass.cpp +++ b/test/sync/futures/shared_future/wait_until_pass.cpp @@ -33,6 +33,10 @@ #if defined BOOST_THREAD_USES_CHRONO +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::chrono::milliseconds ms; namespace boost diff --git a/test/sync/futures/when_all/iterators_pass.cpp b/test/sync/futures/when_all/iterators_pass.cpp index cebf4192..2646074f 100644 --- a/test/sync/futures/when_all/iterators_pass.cpp +++ b/test/sync/futures/when_all/iterators_pass.cpp @@ -31,6 +31,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { return 123; diff --git a/test/sync/futures/when_all/one_pass.cpp b/test/sync/futures/when_all/one_pass.cpp index a39e638e..026abcf5 100644 --- a/test/sync/futures/when_all/one_pass.cpp +++ b/test/sync/futures/when_all/one_pass.cpp @@ -30,6 +30,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { return 123; diff --git a/test/sync/futures/when_all/variadic_pass.cpp b/test/sync/futures/when_all/variadic_pass.cpp index 1c864c59..f3b93b8b 100644 --- a/test/sync/futures/when_all/variadic_pass.cpp +++ b/test/sync/futures/when_all/variadic_pass.cpp @@ -30,6 +30,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { boost::this_thread::sleep_for(boost::chrono::milliseconds(100)); diff --git a/test/sync/futures/when_any/iterators_pass.cpp b/test/sync/futures/when_any/iterators_pass.cpp index 75a30cc4..a4b5f794 100644 --- a/test/sync/futures/when_any/iterators_pass.cpp +++ b/test/sync/futures/when_any/iterators_pass.cpp @@ -31,6 +31,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { return 123; diff --git a/test/sync/futures/when_any/one_pass.cpp b/test/sync/futures/when_any/one_pass.cpp index f54d8376..61882ef6 100644 --- a/test/sync/futures/when_any/one_pass.cpp +++ b/test/sync/futures/when_any/one_pass.cpp @@ -28,6 +28,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { return 123; diff --git a/test/sync/futures/when_any/variadic_pass.cpp b/test/sync/futures/when_any/variadic_pass.cpp index cee81ef1..9f6e93fb 100644 --- a/test/sync/futures/when_any/variadic_pass.cpp +++ b/test/sync/futures/when_any/variadic_pass.cpp @@ -29,6 +29,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + int p1() { return 123; diff --git a/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp b/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp index d0626b98..92e18307 100644 --- a/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp +++ b/test/sync/mutual_exclusion/sync_pq/pq_multi_thread_pass.cpp @@ -21,6 +21,10 @@ #include +#ifdef BOOST_MSVC +#pragma warning(disable: 4127) // conditional expression is constant +#endif + typedef boost::concurrent::sync_priority_queue sync_pq; int call_pull(sync_pq* q, boost::barrier* go) diff --git a/test/test_5542_1.cpp b/test/test_5542_1.cpp index 08bab885..4d088dc8 100644 --- a/test/test_5542_1.cpp +++ b/test/test_5542_1.cpp @@ -31,7 +31,7 @@ public: void processQueue(unsigned N) { - float ms = N * 1e3; + unsigned ms = N * 1000; boost::posix_time::milliseconds workTime(ms); // std::cout << "Worker: started, will work for " diff --git a/test/test_futures.cpp b/test/test_futures.cpp index 3dae0fa6..61515169 100644 --- a/test/test_futures.cpp +++ b/test/test_futures.cpp @@ -19,6 +19,10 @@ #include +#ifdef BOOST_MSVC +# pragma warning(disable: 4267) // conversion from ... to ..., possible loss of data +#endif + #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template typename boost::remove_reference::type&& cast_to_rval(T&& t)