Fix gtest and related warnings (#1224)

This commit is contained in:
Anton Kolesnyk 2020-12-18 18:20:02 -08:00 committed by GitHub
parent 1502468dba
commit e3d8719281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -38,11 +38,19 @@ inline void LogThis(std::string const& msg)
}
template <typename T>
#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
{

View File

@ -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(

View File

@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src>)