From fec6a2c1d74a7d89d09bb293a12b15bdc8b83178 Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr" Date: Thu, 17 Nov 2022 13:44:28 -0800 Subject: [PATCH] core: use maybe_unused instead of `(void)' cast --- build-support/macros-and-definitions.cmake | 6 ++---- src/core/model/assert.h | 4 ++-- src/core/model/test.cc | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/build-support/macros-and-definitions.cmake b/build-support/macros-and-definitions.cmake index a8dec48b5..6bfbac500 100644 --- a/build-support/macros-and-definitions.cmake +++ b/build-support/macros-and-definitions.cmake @@ -1183,9 +1183,8 @@ macro(process_options) if(${NS3_INT64X64} MATCHES "INT128") check_cxx_source_compiles( "#include - int main(int argc, char **argv) + int main() { - (void)argc; (void)argv; if ((uint128_t *) 0) return 0; if (sizeof (uint128_t)) return 0; return 1; @@ -1194,9 +1193,8 @@ macro(process_options) ) check_cxx_source_compiles( "#include - int main(int argc, char **argv) + int main() { - (void)argc; (void)argv; if ((__uint128_t *) 0) return 0; if (sizeof (__uint128_t)) return 0; return 1; diff --git a/src/core/model/assert.h b/src/core/model/assert.h index 4902412e9..104a9e97c 100644 --- a/src/core/model/assert.h +++ b/src/core/model/assert.h @@ -98,13 +98,13 @@ #define NS_ASSERT(condition) \ do \ { \ - (void)sizeof(condition); \ + sizeof(condition); \ } while (false) #define NS_ASSERT_MSG(condition, message) \ do \ { \ - (void)sizeof(condition); \ + sizeof(condition); \ } while (false) #endif /* NS3_ASSERT_ENABLE */ diff --git a/src/core/model/test.cc b/src/core/model/test.cc index b2392a904..cb268ba64 100644 --- a/src/core/model/test.cc +++ b/src/core/model/test.cc @@ -54,7 +54,7 @@ TestDoubleIsEqual(const double x1, const double x2, const double epsilon) // { double max = (std::fabs(x1) > std::fabs(x2)) ? x1 : x2; - (void)std::frexp(max, &exponent); + std::frexp(max, &exponent); } //