From 02e73a058606bbbd33edf3468d6a3327249a4042 Mon Sep 17 00:00:00 2001 From: Li Cao Date: Tue, 15 Jul 2025 01:30:45 +0800 Subject: [PATCH] [format] enable simplify demorgan option (#11715) --- .clang-tidy | 3 --- src/core/common/debug.hpp | 10 ++++++++-- src/core/net/srp_server.cpp | 2 +- src/core/utils/channel_manager.cpp | 2 +- src/lib/platform/exit_code.h | 5 ++++- tests/unit/test_util.h | 5 ++++- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index bf6dfdce6..224827af6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -20,8 +20,5 @@ Checks: > readability-redundant-member-init, readability-simplify-boolean-expr, readability-static-accessed-through-instance -CheckOptions: - - key: readability-simplify-boolean-expr.SimplifyDeMorgan - value: false WarningsAsErrors: '*' HeaderFilterRegex: '(examples|include|src).*(?().IsRxOnWhenIdle() && Get().IsCslEnabled())) + if (Get().IsRxOnWhenIdle() || !Get().IsCslEnabled()) { // cannot select or use other channel ExitNow(); diff --git a/src/lib/platform/exit_code.h b/src/lib/platform/exit_code.h index 720fcb73f..7a255981e 100644 --- a/src/lib/platform/exit_code.h +++ b/src/lib/platform/exit_code.h @@ -113,7 +113,10 @@ const char *otExitCodeToString(uint8_t aExitCode); #define VerifyOrDie(aCondition, aExitCode) \ do \ { \ - if (!(aCondition)) \ + if (aCondition) \ + { \ + } \ + else \ { \ const char *start = strrchr(__FILE__, '/'); \ OT_UNUSED_VARIABLE(start); \ diff --git a/tests/unit/test_util.h b/tests/unit/test_util.h index ace804298..332f9dfeb 100644 --- a/tests/unit/test_util.h +++ b/tests/unit/test_util.h @@ -66,7 +66,10 @@ extern "C" { #define VerifyOrQuit(...) \ do \ { \ - if (!(OT_FIRST_ARG(__VA_ARGS__))) \ + if ((OT_FIRST_ARG(__VA_ARGS__))) \ + { \ + } \ + else \ { \ fprintf(stderr, "\nFAILED %s:%d - VerifyOrQuit(%s) " OT_SECOND_ARG(__VA_ARGS__) "\n", __FUNCTION__, \ __LINE__, _Stringize(OT_FIRST_ARG(__VA_ARGS__))); \