From b78f115fcfad313a51d72af8db1dd591f8f6888c Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 14 Dec 2019 10:48:19 -0800 Subject: [PATCH] Work around VS2019 16.4.0 bugs (#2171) Work around frontend bug in scoped_lock and code generation bug in reverse_iterator in gtest. See https://github.com/google/googletest/pull/2635 --- cscore/src/main/native/cpp/HttpCameraImpl.cpp | 4 ++++ cscore/src/main/native/cpp/UnlimitedHandleResource.h | 4 ++++ hal/src/main/native/include/mockdata/SimCallbackRegistry.h | 4 ++++ shared/config.gradle | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cscore/src/main/native/cpp/HttpCameraImpl.cpp b/cscore/src/main/native/cpp/HttpCameraImpl.cpp index 5bf7a8ab37..57c86a8c99 100644 --- a/cscore/src/main/native/cpp/HttpCameraImpl.cpp +++ b/cscore/src/main/native/cpp/HttpCameraImpl.cpp @@ -412,7 +412,11 @@ std::unique_ptr HttpCameraImpl::CreateEmptyProperty( } bool HttpCameraImpl::CacheProperties(CS_Status* status) const { +#ifdef _MSC_VER // work around VS2019 16.4.0 bug + std::scoped_lock lock(m_mutex); +#else std::scoped_lock lock(m_mutex); +#endif // Pretty typical set of video modes m_videoModes.clear(); diff --git a/cscore/src/main/native/cpp/UnlimitedHandleResource.h b/cscore/src/main/native/cpp/UnlimitedHandleResource.h index 6c9a538eaa..200572c498 100644 --- a/cscore/src/main/native/cpp/UnlimitedHandleResource.h +++ b/cscore/src/main/native/cpp/UnlimitedHandleResource.h @@ -78,7 +78,11 @@ template template THandle UnlimitedHandleResource::Allocate( Args&&... args) { +#ifdef _MSC_VER // work around VS2019 16.4.0 bug + std::scoped_lock lock(m_handleMutex); +#else std::scoped_lock sync(m_handleMutex); +#endif size_t i; for (i = 0; i < m_structures.size(); i++) { if (m_structures[i] == nullptr) { diff --git a/hal/src/main/native/include/mockdata/SimCallbackRegistry.h b/hal/src/main/native/include/mockdata/SimCallbackRegistry.h index 7190dcfdd5..3e1aeb013f 100644 --- a/hal/src/main/native/include/mockdata/SimCallbackRegistry.h +++ b/hal/src/main/native/include/mockdata/SimCallbackRegistry.h @@ -74,7 +74,11 @@ class SimCallbackRegistry : public impl::SimCallbackRegistryBase { template void Invoke(U&&... u) const { +#ifdef _MSC_VER // work around VS2019 16.4.0 bug + std::scoped_lock lock(m_mutex); +#else std::scoped_lock lock(m_mutex); +#endif if (m_callbacks) { const char* name = GetName(); for (auto&& cb : *m_callbacks) diff --git a/shared/config.gradle b/shared/config.gradle index 20ec083e08..8ee810b062 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -10,7 +10,7 @@ nativeUtils { wpiVersion = "-1" niLibVersion = "2020.9.1" opencvVersion = "3.4.7-2" - googleTestVersion = "1.9.0-3-437e100" + googleTestVersion = "1.9.0-4-437e100-1" imguiVersion = "1.72b-2" } }