Disable warnings for AMQP tests (#4633)

* Disable warnings for AMQP tests

* Added cmake presets for linux for ease of use.
This commit is contained in:
Larry Osterman 2023-05-15 11:35:10 -07:00 committed by GitHub
parent 5a348b6766
commit 7066f4c956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 12 deletions

View File

@ -1,5 +1,5 @@
{
"version": 2,
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 13,
@ -20,6 +20,11 @@
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ]
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
@ -298,6 +303,40 @@
"BUILD_PERFORMANCE_TESTS": true,
"BUILD_SAMPLES": true
}
},
{
"name": "linux-basic-gcc9",
"displayName": "Linux GCC 9 ",
"description": "Using compilers: C = /usr/bin/gcc-9, CXX = /usr/bin/g++-9",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_C_COMPILER": "/usr/bin/gcc-9",
"CMAKE_CXX_COMPILER": "/usr/bin/g++-9"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "linux-gcc9-debug",
"displayName": "Linux GCC 9 Debug",
"inherits": "linux-basic-gcc9",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux-gcc9-debug-tests",
"inherits": "linux-gcc9-debug",
"displayName": "Linux GCC 9 Debug+Tests",
"cacheVariables": {
"BUILD_TESTING": "true"
}
}
]
}

View File

@ -20,6 +20,9 @@ template <> struct Azure::Core::_internal::UniqueHandleHelper<MESSAGE_INSTANCE_T
using type = Azure::Core::_internal::BasicUniqueHandle<MESSAGE_INSTANCE_TAG, FreeAmqpMessage>;
};
namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace _internal {
class AmqpMessageFactory;
}}}}} // namespace Azure::Core::Amqp::Models::_internal
namespace Azure { namespace Core { namespace Amqp { namespace Models {
/**
@ -36,10 +39,6 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models {
};
using UniqueMessageHandle = Azure::Core::_internal::UniqueHandle<MESSAGE_INSTANCE_TAG>;
namespace _internal {
class AmqpMessageFactory;
}
constexpr int AmqpMessageFormatValue = 0; // Specifies the message format for an AMQP message.
class AmqpMessage final {
@ -50,17 +49,21 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models {
/** @brief Destroy an instance of an AMQP Message object. */
~AmqpMessage() = default;
/** @brief Create a new AMQP Message from an existing message moving the contents. */
AmqpMessage(AmqpMessage&&) = default;
/** @brief Construct a new AMQP message object from an existing object. */
AmqpMessage(AmqpMessage const&) = default;
/** @brief Copy an AMQP message object to another object. @returns A reference to this.*/
/** @brief Copy an AMQP message object to another object.
* @returns A reference to this.
*/
AmqpMessage& operator=(AmqpMessage const&) = default;
/** @brief Create a new AMQP Message from an existing message moving the contents. */
AmqpMessage(AmqpMessage&&) noexcept = default;
/** @brief Move an AMQP message object to another object. @returns A reference to this.*/
AmqpMessage& operator=(AmqpMessage&&) noexcept = default;
/** @brief Move an AMQP message object to another object.
* @returns A reference to this.
*/
AmqpMessage& operator=(AmqpMessage&&) = default;
bool operator==(AmqpMessage const& other) const noexcept;
bool operator!=(AmqpMessage const& other) const noexcept { return !(*this == other); }

View File

@ -61,7 +61,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models {
{
if (message == nullptr)
{
return AmqpMessage(nullptr);
return nullptr;
}
AmqpMessage rv;
rv.Header = _internal::MessageHeaderFactory::FromUamqp(GetHeaderFromMessage(message));

View File

@ -31,6 +31,22 @@ add_executable(azure-core-amqp-tests
)
add_dependencies(azure-core-amqp-tests azure-core-amqp)
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)
# - C6326: Google comparisons
target_compile_options(azure-core-amqp-tests PUBLIC /wd26495 /wd26812 /wd6326 /wd28204 /wd28020 /wd6330 /wd4389)
endif()
target_include_directories(azure-core-amqp-tests PRIVATE ${azure-core-amqp_SOURCE_DIR})
# Link test executable against gtest & gtest_main