diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index bd54a71cc..71253ab72 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -38,11 +38,19 @@ inline void LogThis(std::string const& msg) } template +#if defined(_MSC_VER) +#pragma warning(push) +// C26812: The enum type 'CURLoption' is unscoped. Prefer 'enum class' over 'enum' (Enum.3) +#pragma warning(disable : 26812) +#endif inline bool SetLibcurlOption(CURL* handle, CURLoption option, T value, CURLcode* outError) { *outError = curl_easy_setopt(handle, option, value); return *outError == CURLE_OK; } +#if defined(_MSC_VER) +#pragma warning(pop) +#endif enum class PollSocketDirection { diff --git a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp index c8f582b64..17412f92e 100644 --- a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp @@ -101,7 +101,15 @@ namespace Azure { namespace Core { namespace Http { // Get the socket that libcurl is using from handle. Will use this to wait while // reading/writing // into wire +#if defined(_MSC_VER) +#pragma warning(push) +// C26812: The enum type 'CURLcode' is unscoped. Prefer 'enum class' over 'enum' (Enum.3) +#pragma warning(disable : 26812) +#endif auto result = curl_easy_getinfo(m_handle, CURLINFO_ACTIVESOCKET, &m_curlSocket); +#if defined(_MSC_VER) +#pragma warning(pop) +#endif if (result != CURLE_OK) { throw Http::TransportException( diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index 043387e4e..e17716861 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -52,6 +52,21 @@ add_executable ( uuid.cpp ) +if (MSVC) + # Disable warnings: + # - C26495: Variable + # - 'testing::internal::Mutex::critical_section_' + # - 'testing::internal::Mutex::critical_section_init_phase_' + # - 'testing::internal::Mutex::owner_thread_id_' + # - 'testing::internal::Mutex::type_' + # is uninitialized. Always initialize member variables (type.6). + # - C26812: The enum type + # - 'testing::internal::Mutex::StaticConstructorSelector' + # - 'testing::TestPartResult::Type' + # is unscoped. Prefer 'enum class' over 'enum' (Enum.3) + target_compile_options(azure-core-test PUBLIC /wd26495 /wd26812) +endif() + # Adding private headers from CORE to the tests so we can test the private APIs with no relative paths include. target_include_directories (azure-core-test PRIVATE $)