diff --git a/.cspell.json b/.cspell.json index 91c94d92359..80684b9bb81 100644 --- a/.cspell.json +++ b/.cspell.json @@ -148,6 +148,8 @@ "gnustl", "libgnustl", "Wmissing", + "Wmaybe", + "Wuninitialized", // Android NDK "JNIEXPORT", "jint", diff --git a/cmake/compiler_settings.cmake b/cmake/compiler_settings.cmake index c0c19e5b8da..41fcf937859 100644 --- a/cmake/compiler_settings.cmake +++ b/cmake/compiler_settings.cmake @@ -11,6 +11,9 @@ else() set(COMPILER_CLANG 1) else() set(COMPILER_GCC 1) + if(MINGW) + set(COMPILER_MINGW 1) + endif() endif() set(USE_GCC_FLAGS 1) endif() @@ -34,6 +37,9 @@ endfunction() macro(set_gcc_flags) list(APPEND AWS_COMPILER_FLAGS "-fno-exceptions" "-std=c++${CPP_STANDARD}") + if(COMPILER_IS_MINGW) + list(APPEND AWS_COMPILER_FLAGS -D__USE_MINGW_ANSI_STDIO=1) + endif() if(NOT BUILD_SHARED_LIBS) list(APPEND AWS_COMPILER_FLAGS "-fPIC") diff --git a/src/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h b/src/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h index 19199ac462f..c9fffc2b7a2 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h +++ b/src/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h @@ -16,6 +16,12 @@ #include #include +#ifdef __MINGW32__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif + namespace Aws { namespace Utils @@ -350,3 +356,7 @@ namespace Aws } } } + +#ifdef __MINGW32__ +#pragma GCC diagnostic pop +#endif diff --git a/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp b/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp index c18b78b52ff..eeae903740a 100644 --- a/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp +++ b/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include // for tcp_keepalive #include @@ -696,7 +696,7 @@ bool WinHttpSyncHttpClient::DoQueryHeaders(void* hHttpRequest, std::shared_ptr(dwSize / sizeof(wchar_t))); WinHttpQueryHeaders(hHttpRequest, WINHTTP_QUERY_CONTENT_TYPE, nullptr, &contentTypeStr, &dwSize, 0); - if (contentTypeStr[0] != NULL) + if (contentTypeStr[0]) { Aws::String contentStr = StringUtils::FromWString(contentTypeStr); response->SetContentType(contentStr); @@ -727,7 +727,7 @@ bool WinHttpSyncHttpClient::DoQueryHeaders(void* hHttpRequest, std::shared_ptrSetContentType(contentTypeStr); AWS_LOGSTREAM_DEBUG(GetLogTag(), "Received content type " << contentTypeStr); diff --git a/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp b/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp index b6678e1cc9c..4a799f619ce 100644 --- a/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp +++ b/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp @@ -12,7 +12,9 @@ #include #include -#pragma warning( disable : 4996) +#ifdef _MSC_VER +#pragma warning(disable: 4996) +#endif using namespace Aws::Utils; namespace Aws @@ -311,6 +313,9 @@ Aws::String CreateTempFilePath() { #ifdef _MSC_VER #pragma warning(disable: 4996) // _CRT_SECURE_NO_WARNINGS +#elif !defined(L_tmpnam_s) + // Definition from the MSVC stdio.h + #define L_tmpnam_s (sizeof("\\") + 16) #endif char s_tempName[L_tmpnam_s+1]; diff --git a/src/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp b/src/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp index e2c4a017f0a..c849fbc993a 100644 --- a/src/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp +++ b/src/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp @@ -9,7 +9,9 @@ #include +#ifdef _MSC_VER #pragma warning(disable: 4996) +#endif #include #include namespace Aws diff --git a/src/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp b/src/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp index 33f562c3608..46bd1f1e9a9 100644 --- a/src/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp +++ b/src/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp @@ -809,7 +809,7 @@ std::shared_ptr Aws::Utils::Crypto::CreateSha256HMACIm return GetSha256HMACFactory()->CreateImplementation(); } -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4702 ) #endif @@ -902,7 +902,7 @@ std::shared_ptr Aws::Utils::Crypto::CreateAES_KeyWrapImplementa return GetAES_KeyWrapFactory()->CreateImplementation(key); } -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp index 1c80649d2c1..1f13967b7fb 100644 --- a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp +++ b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp @@ -49,7 +49,7 @@ #include #include -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(disable: 4127) #ifdef GetObject #undef GetObject diff --git a/tests/testing-resources/include/aws/testing/AwsProtocolTestHelpers.h b/tests/testing-resources/include/aws/testing/AwsProtocolTestHelpers.h index 18189aa6cdd..16e44472b09 100644 --- a/tests/testing-resources/include/aws/testing/AwsProtocolTestHelpers.h +++ b/tests/testing-resources/include/aws/testing/AwsProtocolTestHelpers.h @@ -6,7 +6,7 @@ #pragma once #include -#include s +#include #include diff --git a/tests/testing-resources/source/platform/windows/PlatformTesting.cpp b/tests/testing-resources/source/platform/windows/PlatformTesting.cpp index f3c375a2c16..729c2e01708 100644 --- a/tests/testing-resources/source/platform/windows/PlatformTesting.cpp +++ b/tests/testing-resources/source/platform/windows/PlatformTesting.cpp @@ -5,7 +5,9 @@ #include +#ifdef _MSC_VER #pragma warning(disable: 4996) +#endif #include #include