From ff85c9868321fd00bb4037e0a068e223ddc97197 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 18 Jun 2021 18:40:32 -0400 Subject: Some fixes for MinGW * Rename Windows.h uses to windows.h * Comment out structured exception handling usage Makes MinGW happier. Mostly the same as previous work by Nicolas Dufresne , with the exception that we now don't try to invoke RaiseException which would fail in MinGW as it raises a Windows structured exception. --- meson.build | 2 ++ webrtc/rtc_base/platform_thread_types.cc | 2 ++ webrtc/rtc_base/synchronization/rw_lock_win.h | 2 +- webrtc/rtc_base/system/file_wrapper.cc | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index b4cce45..1baa489 100644 --- a/meson.build +++ b/meson.build @@ -105,6 +105,8 @@ elif host_system == 'linux' have_posix = true elif host_system == 'windows' platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32', '-U__STRICT_ANSI__'] + # this one is for MinGW to get format specifiers from inttypes.h in C++ + platform_cflags += ['-D__STDC_FORMAT_MACROS=1'] os_deps += [cc.find_library('winmm')] have_win = true endif diff --git a/webrtc/rtc_base/platform_thread_types.cc b/webrtc/rtc_base/platform_thread_types.cc index b0243b4..ea1dd61 100644 --- a/webrtc/rtc_base/platform_thread_types.cc +++ b/webrtc/rtc_base/platform_thread_types.cc @@ -99,11 +99,13 @@ void SetCurrentThreadName(const char* name) { #pragma warning(push) #pragma warning(disable : 6320 6322) +#ifndef __MINGW32__ __try { ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR), reinterpret_cast(&threadname_info)); } __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT } +#endif #pragma warning(pop) #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) prctl(PR_SET_NAME, reinterpret_cast(name)); // NOLINT diff --git a/webrtc/rtc_base/synchronization/rw_lock_win.h b/webrtc/rtc_base/synchronization/rw_lock_win.h index 43bde1d..c79e61e 100644 --- a/webrtc/rtc_base/synchronization/rw_lock_win.h +++ b/webrtc/rtc_base/synchronization/rw_lock_win.h @@ -11,7 +11,7 @@ #ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_ #define RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_ -#include +#include #include "rtc_base/synchronization/rw_lock_wrapper.h" diff --git a/webrtc/rtc_base/system/file_wrapper.cc b/webrtc/rtc_base/system/file_wrapper.cc index 2828790..3b5f744 100644 --- a/webrtc/rtc_base/system/file_wrapper.cc +++ b/webrtc/rtc_base/system/file_wrapper.cc @@ -14,7 +14,7 @@ #include #ifdef _WIN32 -#include +#include #else #include #endif -- cgit v1.2.1