Replace static_cast<void>() with [[maybe_unused]] attribute (#5892)

This clarifies intent. Not done for thirdparty libraries or
structured binding variables.
This commit is contained in:
Tyler Veness
2023-11-08 12:47:23 -08:00
committed by GitHub
parent 70392cbbcb
commit 3a1194be40
7 changed files with 23 additions and 55 deletions

View File

@@ -190,12 +190,12 @@ struct RelayHandle {
HAL_RelayHandle handle = 0;
};
#define ASSERT_LAST_ERROR_STATUS(status, x) \
do { \
ASSERT_EQ(status, HAL_USE_LAST_ERROR); \
const char* lastErrorMessageInMacro = HAL_GetLastError(&status); \
static_cast<void>(lastErrorMessageInMacro); \
ASSERT_EQ(status, x); \
#define ASSERT_LAST_ERROR_STATUS(status, x) \
do { \
ASSERT_EQ(status, HAL_USE_LAST_ERROR); \
[[maybe_unused]] const char* lastErrorMessageInMacro = \
HAL_GetLastError(&status); \
ASSERT_EQ(status, x); \
} while (0)
} // namespace hlt