From fc871fa63e61861dc05249e13e228ebe711fbe35 Mon Sep 17 00:00:00 2001 From: Joseph Klix Date: Tue, 29 Aug 2023 09:51:38 -0700 Subject: [PATCH] remove temporary workaround on windows that undefined getmessage to avoid naming conflict (#2589) --- .../include/aws/core/client/AWSError.h | 17 ++++++++++------- .../source/s3-encryption/S3EncryptionClient.cpp | 3 --- .../materials/KMSEncryptionMaterials.cpp | 7 ------- .../aws/client/AWSClientTest.cpp | 7 ------- .../MediaStoreDataTest.cpp | 3 --- .../include/aws/testing/AwsTestHelpers.h | 4 ---- 6 files changed, 10 insertions(+), 31 deletions(-) diff --git a/src/aws-cpp-sdk-core/include/aws/core/client/AWSError.h b/src/aws-cpp-sdk-core/include/aws/core/client/AWSError.h index e9df0be8a25..3eb136e94df 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/client/AWSError.h +++ b/src/aws-cpp-sdk-core/include/aws/core/client/AWSError.h @@ -12,13 +12,6 @@ #include #include -// TODO: temporary fix for naming conflicts on Windows. -#ifdef _WIN32 -#ifdef GetMessage -#undef GetMessage -#endif -#endif - namespace Aws { namespace Client @@ -114,7 +107,17 @@ namespace Aws /** * Gets the error message. */ +#ifdef _WIN32 + #pragma push_macro("GetMessage") +#undef GetMessage + inline const Aws::String& GetMessage() const { return m_message; } + inline const Aws::String& GetMessageW() const { return GetMessage(); } + inline const Aws::String& GetMessageA() const { return GetMessage(); } + +#pragma pop_macro("GetMessage") +#else inline const Aws::String& GetMessage() const { return m_message; } +#endif //#ifdef _WIN32 /** * Sets the error message */ diff --git a/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/S3EncryptionClient.cpp b/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/S3EncryptionClient.cpp index 61231e0c116..301a5bf5bcb 100644 --- a/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/S3EncryptionClient.cpp +++ b/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/S3EncryptionClient.cpp @@ -8,9 +8,6 @@ // TODO: temporary fix for naming conflicts on Windows. #ifdef _WIN32 -#ifdef GetMessage -#undef GetMessage -#endif #ifdef GetObject #undef GetObject #endif diff --git a/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/materials/KMSEncryptionMaterials.cpp b/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/materials/KMSEncryptionMaterials.cpp index 7e2105a8e98..f0fac7f450f 100644 --- a/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/materials/KMSEncryptionMaterials.cpp +++ b/src/aws-cpp-sdk-s3-encryption/source/s3-encryption/materials/KMSEncryptionMaterials.cpp @@ -18,13 +18,6 @@ using namespace Aws::KMS::Model; using namespace Aws::Client; using namespace Aws::S3Encryption; -// TODO: temporary fix for naming conflicts on Windows. -#ifdef _WIN32 -#ifdef GetMessage -#undef GetMessage -#endif -#endif - namespace Aws { namespace S3Encryption diff --git a/tests/aws-cpp-sdk-core-tests/aws/client/AWSClientTest.cpp b/tests/aws-cpp-sdk-core-tests/aws/client/AWSClientTest.cpp index 89eeac59fd3..6b6ca04f3c3 100644 --- a/tests/aws-cpp-sdk-core-tests/aws/client/AWSClientTest.cpp +++ b/tests/aws-cpp-sdk-core-tests/aws/client/AWSClientTest.cpp @@ -23,13 +23,6 @@ #include #include -// TODO: temporary fix for naming conflicts for Windows. -#ifdef _WIN32 -#ifdef GetMessage -#undef GetMessage -#endif -#endif - using namespace Aws; using namespace Aws::Client; using namespace Aws::Http; diff --git a/tests/aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp b/tests/aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp index fa8ec63e7b9..774f2920220 100644 --- a/tests/aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp +++ b/tests/aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp @@ -40,9 +40,6 @@ using namespace Aws::MediaStoreData::Model; // TODO: temporary fix for naming conflicts on Windows. #ifdef _WIN32 -#ifdef GetMessage -#undef GetMessage -#endif #ifdef GetObject #undef GetObject #endif diff --git a/tests/testing-resources/include/aws/testing/AwsTestHelpers.h b/tests/testing-resources/include/aws/testing/AwsTestHelpers.h index c7931658352..1c95b400af8 100644 --- a/tests/testing-resources/include/aws/testing/AwsTestHelpers.h +++ b/tests/testing-resources/include/aws/testing/AwsTestHelpers.h @@ -14,10 +14,6 @@ #include #include -#if defined(GetMessage) -#undef GetMessage -#endif - #define AWS_ASSERT_SUCCESS(awsCppSdkOutcome) \ ASSERT_TRUE(awsCppSdkOutcome.IsSuccess()) << "Error details: " << awsCppSdkOutcome.GetError() \ << "\nNow timestamp: " << Aws::Utils::DateTime::Now().ToGmtString(Aws::Utils::DateFormat::ISO_8601_BASIC)