From 572c2c84ea8df4af55eab0536b72ca7fd91b3d93 Mon Sep 17 00:00:00 2001
From: Brian Heim <brian@lovelocaldesign.com>
Date: Sun, 12 Mar 2017 10:57:35 -0400
Subject: [PATCH 1/2] boost.thread: patch for gcc 6.2 ICE

See #2473 for history. This is a small patch to basic_thread_pool.hpp
that resolves an internal compiler error generated by gcc 6.2 and 6.3.
---
 .../boost/boost/thread/executors/basic_thread_pool.hpp              | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/external_libraries/boost/boost/thread/executors/basic_thread_pool.hpp b/external_libraries/boost/boost/thread/executors/basic_thread_pool.hpp
index e0d4df2c7..6122ecdb2 100644
--- a/external_libraries/boost/boost/thread/executors/basic_thread_pool.hpp
+++ b/external_libraries/boost/boost/thread/executors/basic_thread_pool.hpp
@@ -137,7 +137,13 @@ namespace executors
         for (unsigned i = 0; i < thread_count; ++i)
         {
 #if 1
+          // fix for gcc 6.2 ICE - see github.com/supercollider/supercollider/pull/2473
+# ifndef __MINGW32__
           thread th (&basic_thread_pool::worker_thread, this);
+# else
+          auto worker = [=](){ this->worker_thread(); };
+          thread th (worker);
+# endif
           threads.push_back(thread_t(boost::move(th)));
 #else
           threads.push_back(thread_t(&basic_thread_pool::worker_thread, this)); // do not compile
-- 
2.11.0


From 482944c3d646e31eed0022a0ebb260b814c895fe Mon Sep 17 00:00:00 2001
From: Brian Heim <brian@lovelocaldesign.com>
Date: Sun, 12 Mar 2017 11:01:01 -0400
Subject: [PATCH 2/2] Reapply boost.chrono changes from a826536, 19dab0c

The two commits above inlined several functions in boost.chrono.
This commit reapplies those changes.
---
 .../chrono/detail/inlined/mac/process_cpu_clocks.hpp     | 16 ++++++++--------
 .../chrono/detail/inlined/posix/process_cpu_clocks.hpp   | 16 ++++++++--------
 .../boost/chrono/detail/inlined/posix/thread_clock.hpp   |  4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/external_libraries/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp b/external_libraries/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
index 6e55b0f2f..0f3ca46e0 100644
--- a/external_libraries/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
+++ b/external_libraries/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
@@ -46,7 +46,7 @@ namespace boost
     }
 
 
-    process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT
+    inline process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT
     {
 #if 1
       tms tm;
@@ -87,7 +87,7 @@ namespace boost
     }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-    process_real_cpu_clock::time_point process_real_cpu_clock::now(system::error_code & ec)
+    inline process_real_cpu_clock::time_point process_real_cpu_clock::now(system::error_code & ec)
     {
 
 #if 1
@@ -165,7 +165,7 @@ namespace boost
 #endif
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-    process_user_cpu_clock::time_point process_user_cpu_clock::now(system::error_code & ec)
+    inline process_user_cpu_clock::time_point process_user_cpu_clock::now(system::error_code & ec)
     {
       tms tm;
       clock_t c = ::times(&tm);
@@ -204,7 +204,7 @@ namespace boost
     }
 #endif
 
-    process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT
+    inline process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT
     {
       tms tm;
       clock_t c = ::times(&tm);
@@ -225,7 +225,7 @@ namespace boost
       }
       return time_point();
     }
-    process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXCEPT
+    inline process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXCEPT
     {
       tms tm;
       clock_t c = ::times(&tm);
@@ -248,7 +248,7 @@ namespace boost
     }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-    process_system_cpu_clock::time_point process_system_cpu_clock::now(system::error_code & ec)
+    inline process_system_cpu_clock::time_point process_system_cpu_clock::now(system::error_code & ec)
     {
       tms tm;
       clock_t c = ::times(&tm);
@@ -287,7 +287,7 @@ namespace boost
     }
 #endif
 
-    process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT
+    inline process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT
     {
       tms tm;
       clock_t c = ::times(&tm);
@@ -312,7 +312,7 @@ namespace boost
     }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-    process_cpu_clock::time_point process_cpu_clock::now(system::error_code & ec)
+    inline process_cpu_clock::time_point process_cpu_clock::now(system::error_code & ec)
     {
 
       tms tm;
diff --git a/external_libraries/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp b/external_libraries/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
index feecc8679..a687e6c32 100644
--- a/external_libraries/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
+++ b/external_libraries/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
@@ -41,7 +41,7 @@ namespace chrono_detail
   }
 }
 
-process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT
+inline process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT
 {
     tms tm;
     clock_t c = ::times( &tm );
@@ -65,7 +65,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT
 }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-process_real_cpu_clock::time_point process_real_cpu_clock::now(
+inline process_real_cpu_clock::time_point process_real_cpu_clock::now(
         system::error_code & ec)
 {
 
@@ -118,7 +118,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now(
 }
 #endif
 
-process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT
+inline process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT
 {
     tms tm;
     clock_t c = ::times( &tm );
@@ -142,7 +142,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT
 }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-process_user_cpu_clock::time_point process_user_cpu_clock::now(
+inline process_user_cpu_clock::time_point process_user_cpu_clock::now(
         system::error_code & ec)
 {
     tms tm;
@@ -194,7 +194,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now(
 }
 #endif
 
-process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXCEPT
+inline process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXCEPT
 {
     tms tm;
     clock_t c = ::times( &tm );
@@ -219,7 +219,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXC
 }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-process_system_cpu_clock::time_point process_system_cpu_clock::now(
+inline process_system_cpu_clock::time_point process_system_cpu_clock::now(
         system::error_code & ec)
 {
     tms tm;
@@ -271,7 +271,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now(
 }
 #endif
 
-process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT
+inline process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT
 {
     tms tm;
     clock_t c = ::times( &tm );
@@ -299,7 +299,7 @@ process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT
 }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-process_cpu_clock::time_point process_cpu_clock::now(
+inline process_cpu_clock::time_point process_cpu_clock::now(
         system::error_code & ec )
 {
     tms tm;
diff --git a/external_libraries/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp b/external_libraries/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp
index a42b3c8a1..84d5f6514 100644
--- a/external_libraries/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp
+++ b/external_libraries/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp
@@ -23,7 +23,7 @@
 
 namespace boost { namespace chrono {
 
-    thread_clock::time_point thread_clock::now( ) BOOST_NOEXCEPT
+    inline thread_clock::time_point thread_clock::now( ) BOOST_NOEXCEPT
     {
       struct timespec ts;
 #if defined CLOCK_THREAD_CPUTIME_ID
@@ -49,7 +49,7 @@ namespace boost { namespace chrono {
     }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
-    thread_clock::time_point thread_clock::now( system::error_code & ec )
+    inline thread_clock::time_point thread_clock::now( system::error_code & ec )
     {
       struct timespec ts;
 #if defined CLOCK_THREAD_CPUTIME_ID
-- 
2.11.0

