[format] enable simplify demorgan option (#11715)

This commit is contained in:
Li Cao
2025-07-14 10:30:45 -07:00
committed by GitHub
parent 5944b5e983
commit 02e73a0586
6 changed files with 18 additions and 9 deletions
-3
View File
@@ -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).*(?<!third_party.*repo)'
+8 -2
View File
@@ -55,7 +55,10 @@
#define OT_ASSERT(cond) \
do \
{ \
if (!(cond)) \
if (cond) \
{ \
} \
else \
{ \
otPlatAssertFail(FILE_NAME, __LINE__); \
while (1) \
@@ -75,7 +78,10 @@
#define OT_ASSERT(cond) \
do \
{ \
if (!(cond)) \
if (cond) \
{ \
} \
else \
{ \
while (1) \
{ \
+1 -1
View File
@@ -721,7 +721,7 @@ void Server::CommitSrpUpdate(Error aError,
exit:
if (aMessageInfo != nullptr)
{
if (aError == kErrorNone && !(grantedLease == hostLease && grantedKeyLease == hostKeyLease))
if (aError == kErrorNone && (grantedLease != hostLease || grantedKeyLease != hostKeyLease))
{
SendResponse(aDnsHeader, grantedLease, grantedKeyLease, useShortLease, *aMessageInfo);
}
+1 -1
View File
@@ -112,7 +112,7 @@ exit:
#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_CSL_CHANNEL_SELECT_ENABLE
void ChannelManager::ChangeCslChannel(uint8_t aChannel)
{
if (!(!Get<Mle::Mle>().IsRxOnWhenIdle() && Get<Mac::Mac>().IsCslEnabled()))
if (Get<Mle::Mle>().IsRxOnWhenIdle() || !Get<Mac::Mac>().IsCslEnabled())
{
// cannot select or use other channel
ExitNow();
+4 -1
View File
@@ -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); \
+4 -1
View File
@@ -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__))); \