godot.patch 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. diff --git a/thirdparty/mingw-std-threads/mingw.condition_variable.h b/thirdparty/mingw-std-threads/mingw.condition_variable.h
  2. index 50c5ebd6df..d099fad2ec 100644
  3. --- a/thirdparty/mingw-std-threads/mingw.condition_variable.h
  4. +++ b/thirdparty/mingw-std-threads/mingw.condition_variable.h
  5. @@ -58,7 +58,7 @@
  6. namespace mingw_stdthread
  7. {
  8. -#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
  9. +#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
  10. enum class cv_status { no_timeout, timeout };
  11. #else
  12. using std::cv_status;
  13. @@ -87,12 +87,12 @@ public:
  14. : mSemaphore(CreateSemaphoreA(NULL, 0, 0xFFFF, NULL))
  15. {
  16. if (mSemaphore == NULL)
  17. - throw std::system_error(GetLastError(), std::generic_category());
  18. + __builtin_trap();
  19. mWakeEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  20. if (mWakeEvent == NULL)
  21. {
  22. CloseHandle(mSemaphore);
  23. - throw std::system_error(GetLastError(), std::generic_category());
  24. + __builtin_trap();
  25. }
  26. }
  27. ~condition_variable_any()
  28. @@ -132,7 +132,7 @@ private:
  29. else
  30. {
  31. using namespace std;
  32. - throw system_error(make_error_code(errc::protocol_error));
  33. + __builtin_trap();
  34. }
  35. }
  36. public:
  37. @@ -547,7 +547,7 @@ namespace std
  38. // was none. Direct specification (std::), however, would be unaffected.
  39. // Take the safe option, and include only in the presence of MinGW's win32
  40. // implementation.
  41. -#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
  42. +#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
  43. using mingw_stdthread::cv_status;
  44. using mingw_stdthread::condition_variable;
  45. using mingw_stdthread::condition_variable_any;
  46. diff --git a/thirdparty/mingw-std-threads/mingw.mutex.h b/thirdparty/mingw-std-threads/mingw.mutex.h
  47. index 03efa13f8b..1e881e6c7d 100644
  48. --- a/thirdparty/mingw-std-threads/mingw.mutex.h
  49. +++ b/thirdparty/mingw-std-threads/mingw.mutex.h
  50. @@ -132,7 +132,7 @@ struct _OwnerThread
  51. fprintf(stderr, "FATAL: Recursive locking of non-recursive mutex\
  52. detected. Throwing system exception\n");
  53. fflush(stderr);
  54. - throw system_error(make_error_code(errc::resource_deadlock_would_occur));
  55. + __builtin_trap();
  56. }
  57. DWORD checkOwnerBeforeLock() const
  58. {
  59. @@ -364,13 +364,13 @@ public:
  60. #endif
  61. if ((ret != kWaitObject0) && (ret != kWaitAbandoned))
  62. {
  63. - throw std::system_error(GetLastError(), std::system_category());
  64. + __builtin_trap();
  65. }
  66. }
  67. void unlock()
  68. {
  69. if (!ReleaseMutex(mHandle))
  70. - throw std::system_error(GetLastError(), std::system_category());
  71. + __builtin_trap();
  72. }
  73. bool try_lock()
  74. {
  75. @@ -480,7 +480,7 @@ namespace std
  76. // was none. Direct specification (std::), however, would be unaffected.
  77. // Take the safe option, and include only in the presence of MinGW's win32
  78. // implementation.
  79. -#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
  80. +#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
  81. using mingw_stdthread::recursive_mutex;
  82. using mingw_stdthread::mutex;
  83. using mingw_stdthread::recursive_timed_mutex;
  84. diff --git a/thirdparty/mingw-std-threads/mingw.shared_mutex.h b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
  85. index ff1ac65135..ddc46bb826 100644
  86. --- a/thirdparty/mingw-std-threads/mingw.shared_mutex.h
  87. +++ b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
  88. @@ -134,7 +134,7 @@ public:
  89. using namespace std;
  90. #ifndef NDEBUG
  91. if (!(mCounter.fetch_sub(1, memory_order_release) & static_cast<counter_type>(~kWriteBit)))
  92. - throw system_error(make_error_code(errc::operation_not_permitted));
  93. + __builtin_trap();
  94. #else
  95. mCounter.fetch_sub(1, memory_order_release);
  96. #endif
  97. @@ -187,7 +187,7 @@ public:
  98. using namespace std;
  99. #ifndef NDEBUG
  100. if (mCounter.load(memory_order_relaxed) != kWriteBit)
  101. - throw system_error(make_error_code(errc::operation_not_permitted));
  102. + __builtin_trap();
  103. #endif
  104. mCounter.store(0, memory_order_release);
  105. }
  106. @@ -317,9 +317,9 @@ class shared_lock
  107. {
  108. using namespace std;
  109. if (mMutex == nullptr)
  110. - throw system_error(make_error_code(errc::operation_not_permitted));
  111. + __builtin_trap();
  112. if (mOwns)
  113. - throw system_error(make_error_code(errc::resource_deadlock_would_occur));
  114. + __builtin_trap();
  115. }
  116. public:
  117. typedef Mutex mutex_type;
  118. @@ -432,7 +432,7 @@ public:
  119. {
  120. using namespace std;
  121. if (!mOwns)
  122. - throw system_error(make_error_code(errc::operation_not_permitted));
  123. + __builtin_trap();
  124. mMutex->unlock_shared();
  125. mOwns = false;
  126. }
  127. @@ -484,10 +484,10 @@ namespace std
  128. // was none. Direct specification (std::), however, would be unaffected.
  129. // Take the safe option, and include only in the presence of MinGW's win32
  130. // implementation.
  131. -#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
  132. +#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
  133. using mingw_stdthread::shared_mutex;
  134. #endif
  135. -#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
  136. +#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
  137. using mingw_stdthread::shared_timed_mutex;
  138. using mingw_stdthread::shared_lock;
  139. #elif !defined(MINGW_STDTHREAD_REDUNDANCY_WARNING) // Skip repetition
  140. diff --git a/thirdparty/mingw-std-threads/mingw.thread.h b/thirdparty/mingw-std-threads/mingw.thread.h
  141. index bcdd1a36a8..60d2200db2 100644
  142. --- a/thirdparty/mingw-std-threads/mingw.thread.h
  143. +++ b/thirdparty/mingw-std-threads/mingw.thread.h
  144. @@ -193,10 +193,9 @@ public:
  145. if (int_handle == 0)
  146. {
  147. mHandle = kInvalidHandle;
  148. - int errnum = errno;
  149. delete call;
  150. // Note: Should only throw EINVAL, EAGAIN, EACCES
  151. - throw std::system_error(errnum, std::generic_category());
  152. + __builtin_trap();
  153. } else {
  154. mThreadId.mId = id_receiver;
  155. mHandle = reinterpret_cast<HANDLE>(int_handle);
  156. @@ -213,11 +212,11 @@ public:
  157. {
  158. using namespace std;
  159. if (get_id() == id(GetCurrentThreadId()))
  160. - throw system_error(make_error_code(errc::resource_deadlock_would_occur));
  161. + __builtin_trap();
  162. if (mHandle == kInvalidHandle)
  163. - throw system_error(make_error_code(errc::no_such_process));
  164. + __builtin_trap();
  165. if (!joinable())
  166. - throw system_error(make_error_code(errc::invalid_argument));
  167. + __builtin_trap();
  168. WaitForSingleObject(mHandle, kInfinite);
  169. CloseHandle(mHandle);
  170. mHandle = kInvalidHandle;
  171. @@ -266,7 +265,7 @@ moving another thread to it.\n");
  172. if (!joinable())
  173. {
  174. using namespace std;
  175. - throw system_error(make_error_code(errc::invalid_argument));
  176. + __builtin_trap();
  177. }
  178. if (mHandle != kInvalidHandle)
  179. {
  180. @@ -326,7 +325,7 @@ namespace std
  181. // was none. Direct specification (std::), however, would be unaffected.
  182. // Take the safe option, and include only in the presence of MinGW's win32
  183. // implementation.
  184. -#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
  185. +#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
  186. using mingw_stdthread::thread;
  187. // Remove ambiguity immediately, to avoid problems arising from the above.
  188. //using std::thread;