From 53a17a0499db6bea6a03c64394e3f69e4fd2f7cd Mon Sep 17 00:00:00 2001
From: Bryce Mecum <petridish@gmail.com>
Date: Thu, 30 Jan 2025 10:49:21 -0800
Subject: [PATCH] Move patch hunks into ThirdpartyToolchain.cmake

---
 ci/rtools/aws_c_common_ep.patch             | 15 ---------------
 ci/rtools/awssdk_ep.patch                   | 20 --------------------
 cpp/cmake_modules/ThirdpartyToolchain.cmake |  4 ++--
 3 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/ci/rtools/aws_c_common_ep.patch b/ci/rtools/aws_c_common_ep.patch
index f1357070429ef..94c84d0fe1b5a 100644
--- a/ci/rtools/aws_c_common_ep.patch
+++ b/ci/rtools/aws_c_common_ep.patch
@@ -15,21 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-diff --git a/cmake/AwsCFlags.cmake b/cmake/AwsCFlags.cmake
-index b717bca..5aa8ac9 100644
---- a/cmake/AwsCFlags.cmake
-+++ b/cmake/AwsCFlags.cmake
-@@ -120,6 +120,10 @@ function(aws_set_common_properties target)
-             list(APPEND AWS_C_FLAGS -Wno-strict-aliasing)
-         endif()
-
-+         if (CMAKE_C_IMPLICIT_LINK_LIBRARIES MATCHES "mingw32")
-+            list(APPEND AWS_C_FLAGS -D__USE_MINGW_ANSI_STDIO=1 -Wno-unused-local-typedefs)
-+        endif()
-+
-         # -moutline-atomics generates code for both older load/store exclusive atomics and also
-         # Arm's Large System Extensions (LSE) which scale substantially better on large core count systems.
-         #
 diff --git a/include/aws/common/byte_order.inl b/include/aws/common/byte_order.inl
 index 1204be0..0abd9cb 100644
 --- a/include/aws/common/byte_order.inl
diff --git a/ci/rtools/awssdk_ep.patch b/ci/rtools/awssdk_ep.patch
index f91cc4472911c..3663fa813d295 100644
--- a/ci/rtools/awssdk_ep.patch
+++ b/ci/rtools/awssdk_ep.patch
@@ -55,26 +55,6 @@ index 2b5bbc566..7cb93bdf0 100644
                      std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
  #else
                      std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
-diff --git a/aws-cpp-sdk-core/include/aws/core/utils/crypto/bcrypt/CryptoImpl.h b/aws-cpp-sdk-core/include/aws/core/utils/crypto/bcrypt/CryptoImpl.h
-index e26e36b60..3e7189b70 100644
---- a/aws-cpp-sdk-core/include/aws/core/utils/crypto/bcrypt/CryptoImpl.h
-+++ b/aws-cpp-sdk-core/include/aws/core/utils/crypto/bcrypt/CryptoImpl.h
-@@ -29,7 +29,14 @@ namespace Aws
-     {
-         namespace Crypto
-         {
--            static const char* SecureRandom_BCrypt_Tag = "SecureRandom_BCrypt";
-+#ifdef __MINGW32__
-+#pragma GCC diagnostic push
-+#pragma GCC diagnostic ignored "-Wunused-variable"
-+#endif
-+           static const char* SecureRandom_BCrypt_Tag = "SecureRandom_BCrypt";
-+#ifdef __MINGW32__
-+#pragma GCC diagnostic pop
-+#endif
-
-             class SecureRandomBytes_BCrypt : public SecureRandomBytes
-             {
 diff --git a/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp b/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
 index 4dade6489..a0456cf8e 100644
 --- a/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 01e52bee2f739..4488c01cd9f89 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -5049,11 +5049,11 @@ macro(build_awssdk)
   if(WIN32 AND NOT MSVC)
     string(APPEND
            AWS_C_FLAGS
-           " -D_WIN32_WINNT=0x0601 -Wno-error -Wno-error=format= -Wno-error=format-extra-args"
+           " -D_WIN32_WINNT=0x0601 -D__USE_MINGW_ANSI_STDIO=1 -Wno-error -Wno-error=format= -Wno-error=format-extra-args -Wno-unused-local-typedefs -Wno-unused-variable"
     )
     string(APPEND
            AWS_CXX_FLAGS
-           " -D_WIN32_WINNT=0x0601 -Wno-error -Wno-error=format= -Wno-error=format-extra-args"
+           " -D_WIN32_WINNT=0x0601 -D__USE_MINGW_ANSI_STDIO=1 -Wno-error -Wno-error=format= -Wno-error=format-extra-args -Wno-unused-local-typedefs -Wno-unused-variable"
     )
   endif()