From 3923683f322b23c5ae7f67b0dcb5c23090f33e6e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 3 Nov 2022 17:39:11 -0400 Subject: [PATCH] Misc clang-tidy auto fixes (#23445) * Apply readability-redundant-control-flow,readability-redundant-string-init,readability-redundant-string-cstr on linux-x64-tests-clang * Apply readability-redundant-control-flow,readability-redundant-string-init,readability-redundant-string-cstr on linux-x64-all-clusters-clang * Apply readability-redundant-control-flow,readability-redundant-string-init,readability-redundant-string-cstr on linux-x64-chip-tool-clang * Apply modernize-use-bool-literals * apply performance-for-range-copy * apply readability-const-return-type * Fix compile * Fix compile * Added clang tidy checks as default and re-sorted the list * Fix 2 more items found by clang-tidy during CI * Mass-replace while(1) with while(true) --- .clang-tidy | 40 +++++++++++-------- .../include/static-supported-modes-manager.h | 2 +- .../src/static-supported-modes-manager.cpp | 2 +- .../cc13x2x7_26x2x7/main/AppTask.cpp | 16 ++++---- .../cc13x2x7_26x2x7/main/main.cpp | 6 +-- .../infineon/psoc6/src/main.cpp | 2 +- examples/all-clusters-app/nxp/mw320/main.cpp | 4 +- .../cc13x2x7_26x2x7/main/AppTask.cpp | 16 ++++---- .../cc13x2x7_26x2x7/main/main.cpp | 6 +-- .../infineon/psoc6/src/main.cpp | 2 +- examples/bridge-app/esp32/main/main.cpp | 2 +- examples/bridge-app/linux/main.cpp | 4 +- examples/chef/esp32/main/main.cpp | 2 +- .../chip-tool/commands/common/CHIPCommand.cpp | 3 +- examples/dynamic-bridge-app/linux/main.cpp | 2 +- .../bouffalolab/bl602/src/main.cpp | 2 +- .../bouffalolab/bl702/src/main.cpp | 8 ++-- examples/lighting-app/genio/src/main.cpp | 4 +- .../lighting-app/infineon/psoc6/src/main.cpp | 2 +- .../lock-app/cc13x2x7_26x2x7/main/AppTask.cpp | 16 ++++---- .../cc13x2x7_26x2x7/main/BoltLockManager.cpp | 2 +- .../lock-app/cc13x2x7_26x2x7/main/main.cpp | 6 +-- examples/lock-app/cc32xx/main/AppTask.cpp | 10 ++--- .../lock-app/cc32xx/main/BoltLockManager.cpp | 2 +- examples/lock-app/cc32xx/main/main.cpp | 6 +-- examples/lock-app/infineon/psoc6/src/main.cpp | 2 +- .../cc13x2x7_26x2x7/main.cpp | 6 +-- examples/persistent-storage/efr32/main.cpp | 2 +- .../persistent-storage/esp32/main/main.cpp | 2 +- .../infineon/psoc6/main.cpp | 2 +- examples/persistent-storage/linux/main.cpp | 2 +- examples/persistent-storage/qpg/main.cpp | 2 +- .../include/static-supported-modes-manager.h | 2 +- .../linux/static-supported-modes-manager.cpp | 2 +- .../bouffalolab/bl602/InitPlatform.cpp | 2 +- .../bouffalolab/bl602/MemMonitoring.cpp | 2 +- .../bouffalolab/bl702/MemMonitoring.cpp | 2 +- examples/platform/efr32/MemMonitoring.cpp | 2 +- examples/platform/efr32/efr32_utils.cpp | 2 +- .../linux/CommissioneeShellCommands.cpp | 1 - .../linux/ControllerShellCommands.cpp | 1 - examples/platform/mt793x/link_wrapper.c | 2 +- .../pump-app/cc13x2x7_26x2x7/main/AppTask.cpp | 16 ++++---- .../cc13x2x7_26x2x7/main/PumpManager.cpp | 2 +- .../pump-app/cc13x2x7_26x2x7/main/main.cpp | 6 +-- .../cc13x2x7_26x2x7/main/AppTask.cpp | 16 ++++---- .../cc13x2x7_26x2x7/main/PumpManager.cpp | 2 +- .../cc13x2x7_26x2x7/main/main.cpp | 6 +-- .../shell/cc13x2x7_26x2x7/main/AppTask.cpp | 14 +++---- examples/shell/cc13x2x7_26x2x7/main/main.cpp | 6 +-- examples/shell/efr32/src/main.cpp | 2 +- .../linux/CastingShellCommands.cpp | 1 - .../ethernet-network-diagnostics-server.cpp | 4 +- .../mode-select-server/mode-select-server.cpp | 2 +- .../supported-modes-manager.h | 2 +- .../clusters/on-off-server/on-off-server.cpp | 8 ++-- src/app/util/attribute-storage.cpp | 2 +- src/app/util/attribute-storage.h | 2 +- .../CommissionerDiscoveryController.cpp | 2 - src/darwin/Framework/CHIP/MTRSetupPayload.mm | 2 +- src/lib/dnssd/IncrementalResolve.cpp | 2 +- .../TestTestPersistentStorageDelegate.cpp | 2 +- src/messaging/ExchangeMgr.cpp | 2 - src/platform/DeviceSafeQueue.cpp | 2 +- src/platform/DeviceSafeQueue.h | 2 +- src/platform/EFR32/Logging.cpp | 2 +- src/platform/Infineon/PSOC6/P6Utils.cpp | 2 +- .../cc13x2_26x2/PlatformManagerImpl.cpp | 4 +- src/platform/cc32xx/CC32XXConfig.cpp | 2 +- .../nxp/k32w/k32w0/BLEManagerImpl.cpp | 2 +- src/platform/tests/TestConfigurationMgr.cpp | 2 +- src/setup_payload/tests/TestManualCode.cpp | 4 +- 72 files changed, 162 insertions(+), 164 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 2fa534bc5d2e77..580234c0fad0a3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,36 +1,42 @@ --- Checks: > - readability-else-after-return, - modernize-use-nullptr, bugprone-*, - -bugprone-not-null-terminated-result, - -bugprone-unused-return-value, + modernize-use-bool-literals, + modernize-use-nullptr, + performance-for-range-copy, + readability-const-return-type, + readability-else-after-return, + readability-redundant-control-flow, + readability-redundant-string-cstr, + readability-redundant-string-init, -bugprone-branch-clone, + -bugprone-copy-constructor-init, -bugprone-easily-swappable-parameters, - -bugprone-reserved-identifier, - -bugprone-macro-parentheses, -bugprone-forward-declaration-namespace, -bugprone-forwarding-reference-overload, - -bugprone-undelegated-constructor, -bugprone-implicit-widening-of-multiplication-result, - -bugprone-narrowing-conversions, + -bugprone-macro-parentheses, -bugprone-misplaced-widening-cast, - -bugprone-suspicious-include, + -bugprone-narrowing-conversions, + -bugprone-not-null-terminated-result, + -bugprone-reserved-identifier, -bugprone-signed-char-misuse, - -bugprone-copy-constructor-init, + -bugprone-suspicious-include, + -bugprone-undelegated-constructor, + -bugprone-unused-return-value, -clang-analyzer-core.CallAndMessage, + -clang-analyzer-core.NonNullParamChecker, -clang-analyzer-core.NullDereference, - -clang-analyzer-optin.cplusplus.UninitializedObject, - -clang-analyzer-optin.performance, - -clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, - -clang-analyzer-deadcode.DeadStores, -clang-analyzer-cplusplus.Move, - -clang-analyzer-optin.cplusplus.VirtualCall, - -clang-analyzer-security.insecureAPI.strcpy, + -clang-analyzer-deadcode.DeadStores, -clang-analyzer-nullability.NullablePassedToNonnull, + -clang-analyzer-optin.cplusplus.UninitializedObject, + -clang-analyzer-optin.cplusplus.VirtualCall, + -clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, + -clang-analyzer-optin.performance, -clang-analyzer-optin.performance.Padding, -clang-analyzer-security.insecureAPI.rand, - -clang-analyzer-core.NonNullParamChecker, + -clang-analyzer-security.insecureAPI.strcpy, -clang-analyzer-unix.Malloc, -clang-diagnostic-implicit-int-conversion WarningsAsErrors: '*' diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h index 2d4f674a65920d..8c9515738fa7da 100644 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h @@ -54,7 +54,7 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp public: static const StaticSupportedModesManager instance; - const SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; + SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override; diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp index 8308ab8538de17..c9f118464c27ae 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp @@ -39,7 +39,7 @@ const StaticSupportedModesManager::EndpointSpanPair const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); -const SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const +SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const { for (auto & endpointSpanPair : supportedOptionsByEndpoints) { diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp index 14645f267a43db..871a5f71d6acc0 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -148,7 +148,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -157,7 +157,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -205,7 +205,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } @@ -213,7 +213,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) + while (true) ; } @@ -221,7 +221,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) + while (true) ; } @@ -229,7 +229,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) + while (true) ; } @@ -237,7 +237,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) + while (true) ; } @@ -279,7 +279,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp index cb0641fbc85ee0..8311c8990aa5c6 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -85,13 +85,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/all-clusters-app/infineon/psoc6/src/main.cpp b/examples/all-clusters-app/infineon/psoc6/src/main.cpp index 84b1961f9a881f..2dc8d6353cc62c 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/main.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/main.cpp @@ -59,7 +59,7 @@ void appError(int err) { P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index df0c1dfe6f4e73..d9517faccf0297 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -1027,7 +1027,7 @@ void task_main(void * param) } } - while (1) + while (true) { /* wait for interface up */ os_thread_sleep(os_msec_to_ticks(5000)); @@ -1131,7 +1131,7 @@ static void rst_args_lt(System::Layer * aSystemLayer, void * aAppState) void task_test_main(void * param) { - while (1) + while (true) { /* wait for interface up */ os_thread_sleep(os_msec_to_ticks(500)); diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp index 14645f267a43db..871a5f71d6acc0 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -148,7 +148,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -157,7 +157,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -205,7 +205,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } @@ -213,7 +213,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) + while (true) ; } @@ -221,7 +221,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) + while (true) ; } @@ -229,7 +229,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) + while (true) ; } @@ -237,7 +237,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) + while (true) ; } @@ -279,7 +279,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/main.cpp b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/main.cpp index cb0641fbc85ee0..8311c8990aa5c6 100644 --- a/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/all-clusters-minimal-app/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -85,13 +85,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp index a7587170607d28..5ac891ae1816f2 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp @@ -59,7 +59,7 @@ void appError(int err) { P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 9f26baffa44d2c..fe3cb2e9da11fc 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -167,7 +167,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const SpanSetEndpointId(gCurrentEndpointId); ret = diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index ee545d5619feef..98fcfb1163278f 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -270,7 +270,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const SpanSetEndpointId(gCurrentEndpointId); diff --git a/examples/lighting-app/bouffalolab/bl602/src/main.cpp b/examples/lighting-app/bouffalolab/bl602/src/main.cpp index de96a44d69608c..25620080817951 100644 --- a/examples/lighting-app/bouffalolab/bl602/src/main.cpp +++ b/examples/lighting-app/bouffalolab/bl602/src/main.cpp @@ -51,7 +51,7 @@ void appError(int err) { log_error("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!\r\n", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/lighting-app/bouffalolab/bl702/src/main.cpp b/examples/lighting-app/bouffalolab/bl702/src/main.cpp index 687c6c71212d84..ae194de5fbe0cb 100644 --- a/examples/lighting-app/bouffalolab/bl702/src/main.cpp +++ b/examples/lighting-app/bouffalolab/bl702/src/main.cpp @@ -65,7 +65,7 @@ void appError(int err) { ChipLogProgress(NotSpecified, "!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } @@ -87,7 +87,7 @@ extern "C" unsigned int sleep(unsigned int seconds) extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName) { ChipLogProgress(NotSpecified, "Stack Overflow checked. Stack name %s", pcTaskName); - while (1) + while (true) { /*empty here*/ } @@ -96,7 +96,7 @@ extern "C" void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskN extern "C" void vApplicationMallocFailedHook(void) { ChipLogProgress(NotSpecified, "Memory Allocate Failed. Current left size is %d bytes", xPortGetFreeHeapSize()); - while (1) + while (true) { /*empty here*/ } @@ -168,7 +168,7 @@ extern "C" void vAssertCalled(void) taskDISABLE_INTERRUPTS(); ChipLogProgress(NotSpecified, "vAssertCalled, ra= %p", ra); - while (1) + while (true) ; } diff --git a/examples/lighting-app/genio/src/main.cpp b/examples/lighting-app/genio/src/main.cpp index 93bb82a21b0735..ab578f3f2c75bd 100644 --- a/examples/lighting-app/genio/src/main.cpp +++ b/examples/lighting-app/genio/src/main.cpp @@ -63,7 +63,7 @@ void appError(int err) { printf("!!!!!!!!!!!! Application Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } @@ -270,7 +270,7 @@ extern "C" int main(void) chip::Platform::MemoryShutdown(); // Should never get here. - while (1) + while (true) ; return 0; diff --git a/examples/lighting-app/infineon/psoc6/src/main.cpp b/examples/lighting-app/infineon/psoc6/src/main.cpp index a2dcdae1cc63f1..66ec9addd01aab 100644 --- a/examples/lighting-app/infineon/psoc6/src/main.cpp +++ b/examples/lighting-app/infineon/psoc6/src/main.cpp @@ -58,7 +58,7 @@ void appError(int err) { P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 55bf86deeedecc..1988455e958398 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -96,7 +96,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -105,7 +105,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -125,7 +125,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } @@ -133,7 +133,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) + while (true) ; } #if CHIP_DEVICE_CONFIG_THREAD_FTD @@ -144,7 +144,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) + while (true) ; } @@ -152,7 +152,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) + while (true) ; } @@ -160,7 +160,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) + while (true) ; } @@ -229,7 +229,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/BoltLockManager.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/BoltLockManager.cpp index a6c927cb6cd04b..b048fc9e9d3f09 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/BoltLockManager.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/BoltLockManager.cpp @@ -35,7 +35,7 @@ int BoltLockManager::Init() if (NULL == mTimerHandle) { PLAT_LOG("failed to create bolt lock timer"); - while (1) + while (true) ; } diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp index cb0641fbc85ee0..8311c8990aa5c6 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -85,13 +85,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/lock-app/cc32xx/main/AppTask.cpp b/examples/lock-app/cc32xx/main/AppTask.cpp index 40390e66fc2c94..79da0749349665 100644 --- a/examples/lock-app/cc32xx/main/AppTask.cpp +++ b/examples/lock-app/cc32xx/main/AppTask.cpp @@ -76,7 +76,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -85,7 +85,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -136,7 +136,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } PLAT_LOG("Start Event Loop Task"); @@ -144,7 +144,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) + while (true) ; } @@ -179,7 +179,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/lock-app/cc32xx/main/BoltLockManager.cpp b/examples/lock-app/cc32xx/main/BoltLockManager.cpp index 31c995f7d34d4c..09b9603ff1663e 100644 --- a/examples/lock-app/cc32xx/main/BoltLockManager.cpp +++ b/examples/lock-app/cc32xx/main/BoltLockManager.cpp @@ -35,7 +35,7 @@ int BoltLockManager::Init() if (NULL == mTimerHandle) { PLAT_LOG("failed to create bolt lock timer"); - while (1) + while (true) ; } diff --git a/examples/lock-app/cc32xx/main/main.cpp b/examples/lock-app/cc32xx/main/main.cpp index 4546931d83aba6..aea9449590c69d 100644 --- a/examples/lock-app/cc32xx/main/main.cpp +++ b/examples/lock-app/cc32xx/main/main.cpp @@ -43,7 +43,7 @@ using namespace ::chip::DeviceLayer; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -64,13 +64,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/lock-app/infineon/psoc6/src/main.cpp b/examples/lock-app/infineon/psoc6/src/main.cpp index 8dc525dc8d717f..b14487e4bfe425 100644 --- a/examples/lock-app/infineon/psoc6/src/main.cpp +++ b/examples/lock-app/infineon/psoc6/src/main.cpp @@ -55,7 +55,7 @@ void appError(int err) { P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp b/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp index 9a39bfa9f04e9c..15e439fddb667b 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp +++ b/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp @@ -43,7 +43,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -60,7 +60,7 @@ void TestTask(void * pvParameter) chip::DeviceLayer::Internal::CC13X2_26X2Config().Init(); - while (1) + while (true) { PLAT_LOG("Running Tests:"); chip::RunKvsTest(); @@ -83,6 +83,6 @@ int main(void) vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/persistent-storage/efr32/main.cpp b/examples/persistent-storage/efr32/main.cpp index 3d9674369fa153..2b0c65dd85869c 100644 --- a/examples/persistent-storage/efr32/main.cpp +++ b/examples/persistent-storage/efr32/main.cpp @@ -38,7 +38,7 @@ static TaskHandle_t sTestTaskHandle; void TestTask(void * pvParameter) { - while (1) + while (true) { EFR32_LOG("Running Tests:"); chip::RunKvsTest(); diff --git a/examples/persistent-storage/esp32/main/main.cpp b/examples/persistent-storage/esp32/main/main.cpp index 56ec2ccdf519f5..b107056fbd8fa2 100644 --- a/examples/persistent-storage/esp32/main/main.cpp +++ b/examples/persistent-storage/esp32/main/main.cpp @@ -38,7 +38,7 @@ extern "C" void app_main() ESP_LOGI(TAG, "============================================="); // Run tests - while (1) + while (true) { ESP_LOGI(TAG, "Running Tests:"); diff --git a/examples/persistent-storage/infineon/psoc6/main.cpp b/examples/persistent-storage/infineon/psoc6/main.cpp index 104d63ffea0085..f5acd2c5e74318 100644 --- a/examples/persistent-storage/infineon/psoc6/main.cpp +++ b/examples/persistent-storage/infineon/psoc6/main.cpp @@ -36,7 +36,7 @@ void TestTask(void * pvParameter) P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); return; } - while (1) + while (true) { P6_LOG("Running Tests:"); chip::RunKvsTest(); diff --git a/examples/persistent-storage/linux/main.cpp b/examples/persistent-storage/linux/main.cpp index 03d55bd27d2eb1..297a1e81e715a8 100644 --- a/examples/persistent-storage/linux/main.cpp +++ b/examples/persistent-storage/linux/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char * argv[]) printf("chip-linux-persitent-storage-example starting\n"); printf("=============================================\n"); - while (1) + while (true) { printf("Running Tests:\n"); chip::RunKvsTest(); diff --git a/examples/persistent-storage/qpg/main.cpp b/examples/persistent-storage/qpg/main.cpp index cae4e0eab862c0..0c612e78463c5d 100644 --- a/examples/persistent-storage/qpg/main.cpp +++ b/examples/persistent-storage/qpg/main.cpp @@ -39,7 +39,7 @@ StaticTask_t appTaskStruct; void TestTask(void * pvParameter) { - while (1) + while (true) { qvCHIP_Printf(LOG_MODULE_ID, "Running Tests:"); chip::RunKvsTest(); diff --git a/examples/placeholder/linux/include/static-supported-modes-manager.h b/examples/placeholder/linux/include/static-supported-modes-manager.h index 2d4f674a65920d..8c9515738fa7da 100644 --- a/examples/placeholder/linux/include/static-supported-modes-manager.h +++ b/examples/placeholder/linux/include/static-supported-modes-manager.h @@ -54,7 +54,7 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp public: static const StaticSupportedModesManager instance; - const SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; + SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override; diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp index 8308ab8538de17..c9f118464c27ae 100644 --- a/examples/placeholder/linux/static-supported-modes-manager.cpp +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -39,7 +39,7 @@ const StaticSupportedModesManager::EndpointSpanPair const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); -const SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const +SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const { for (auto & endpointSpanPair : supportedOptionsByEndpoints) { diff --git a/examples/platform/bouffalolab/bl602/InitPlatform.cpp b/examples/platform/bouffalolab/bl602/InitPlatform.cpp index 13d03c02bb2f1d..f1b25f312bd2a7 100644 --- a/examples/platform/bouffalolab/bl602/InitPlatform.cpp +++ b/examples/platform/bouffalolab/bl602/InitPlatform.cpp @@ -136,7 +136,7 @@ void vAssertCalled(void) void vApplicationMallocFailedHook(void) { printf("Memory Allocate Failed. Current left size is %d bytes\r\n", xPortGetFreeHeapSize()); - while (1) + while (true) { /*empty here*/ } diff --git a/examples/platform/bouffalolab/bl602/MemMonitoring.cpp b/examples/platform/bouffalolab/bl602/MemMonitoring.cpp index edeea2ddf06281..6c256dbd03be03 100644 --- a/examples/platform/bouffalolab/bl602/MemMonitoring.cpp +++ b/examples/platform/bouffalolab/bl602/MemMonitoring.cpp @@ -55,7 +55,7 @@ void MemMonitoring::HeapMonitoring(void * pvParameter) TaskHandle_t bleLinkTaskHandle = xTaskGetHandle(BLE_LINK_TASK_NAME); TaskHandle_t bleEventTaskHandle = xTaskGetHandle(CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME); - while (1) + while (true) { appTaskValue = uxTaskGetStackHighWaterMark(appTaskHandle); bleEventTaskValue = uxTaskGetStackHighWaterMark(bleEventTaskHandle); diff --git a/examples/platform/bouffalolab/bl702/MemMonitoring.cpp b/examples/platform/bouffalolab/bl702/MemMonitoring.cpp index 8747e85fada191..e0207285db6928 100644 --- a/examples/platform/bouffalolab/bl702/MemMonitoring.cpp +++ b/examples/platform/bouffalolab/bl702/MemMonitoring.cpp @@ -37,7 +37,7 @@ void MemMonitoring::HeapMonitoring(void * pvParameter) char taskState[] = { 'X', 'R', 'B', 'S', 'D' }; // eRunning, eReady, eBlocked, eSuspended, eDeleted uint32_t pulTotalRunTime; - while (1) + while (true) { ChipLogProgress(NotSpecified, "============================="); pTaskStatus = (TaskStatus_t *) malloc(uxTaskGetNumberOfTasks() * sizeof(TaskStatus_t)); diff --git a/examples/platform/efr32/MemMonitoring.cpp b/examples/platform/efr32/MemMonitoring.cpp index dff743aa17711e..36a9b44a19225d 100644 --- a/examples/platform/efr32/MemMonitoring.cpp +++ b/examples/platform/efr32/MemMonitoring.cpp @@ -57,7 +57,7 @@ void MemMonitoring::HeapMonitoring(void * pvParameter) TaskHandle_t lwipHandle = xTaskGetHandle(TCPIP_THREAD_NAME); #endif // CHIP_SYSTEM_CONFIG_USE_LWIP - while (1) + while (true) { appTaskValue = uxTaskGetStackHighWaterMark(appTaskHandle); bleEventTaskValue = uxTaskGetStackHighWaterMark(bleEventTaskHandle); diff --git a/examples/platform/efr32/efr32_utils.cpp b/examples/platform/efr32/efr32_utils.cpp index 1ed1a0fa20fd62..b428435fbc0966 100644 --- a/examples/platform/efr32/efr32_utils.cpp +++ b/examples/platform/efr32/efr32_utils.cpp @@ -27,7 +27,7 @@ void appError(int err) { EFR32_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/platform/linux/CommissioneeShellCommands.cpp b/examples/platform/linux/CommissioneeShellCommands.cpp index bef012defbedeb..f04051b36e8f88 100644 --- a/examples/platform/linux/CommissioneeShellCommands.cpp +++ b/examples/platform/linux/CommissioneeShellCommands.cpp @@ -161,7 +161,6 @@ void RegisterCommissioneeCommands() // Register the root `device` command with the top-level shell. Engine::Root().RegisterCommands(&sDeviceComand, 1); - return; } } // namespace Shell diff --git a/examples/platform/linux/ControllerShellCommands.cpp b/examples/platform/linux/ControllerShellCommands.cpp index ea020be403d720..3d5af4a3a387a1 100644 --- a/examples/platform/linux/ControllerShellCommands.cpp +++ b/examples/platform/linux/ControllerShellCommands.cpp @@ -302,7 +302,6 @@ void RegisterControllerCommands() // Register the root `device` command with the top-level shell. Engine::Root().RegisterCommands(&sDeviceComand, 1); - return; } } // namespace Shell diff --git a/examples/platform/mt793x/link_wrapper.c b/examples/platform/mt793x/link_wrapper.c index 8a4cf726a57533..2b741940828196 100644 --- a/examples/platform/mt793x/link_wrapper.c +++ b/examples/platform/mt793x/link_wrapper.c @@ -47,7 +47,7 @@ void __assert_func(const char * file, int line, const char * func, const char * { fflush(NULL); platform_assert(expr, file, line); - while (1) + while (true) ; } diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index 4aed41ba0cb718..ec04f66a5216f1 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -115,7 +115,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -124,7 +124,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -144,7 +144,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } @@ -152,7 +152,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) + while (true) ; } @@ -166,7 +166,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) + while (true) ; } @@ -174,7 +174,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) + while (true) ; } @@ -238,7 +238,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("CHIPDeviceManager::Init() failed: %s", ErrorStr(ret)); - while (1) + while (true) ; } @@ -251,7 +251,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/PumpManager.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/PumpManager.cpp index 28af445b25caa9..0e7e90e27aba40 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/PumpManager.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/PumpManager.cpp @@ -35,7 +35,7 @@ int PumpManager::Init() if (NULL == mTimerHandle) { PLAT_LOG("failed to create pump timer"); - while (1) + while (true) ; } diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp index ee81c162b3ff70..6137478fc2ffcc 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -85,13 +85,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index 74cbe0d966f161..e8611622fc28dd 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -102,7 +102,7 @@ int AppTask::StartAppTask() if (sAppEventQueue == NULL) { PLAT_LOG("Failed to allocate app event queue"); - while (1) + while (true) ; } @@ -111,7 +111,7 @@ int AppTask::StartAppTask() pdPASS) { PLAT_LOG("Failed to create app task"); - while (1) + while (true) ; } return ret; @@ -131,7 +131,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) + while (true) ; } @@ -139,7 +139,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) + while (true) ; } @@ -147,7 +147,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) + while (true) ; } @@ -155,7 +155,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) + while (true) ; } @@ -163,7 +163,7 @@ int AppTask::Init() if (ret != CHIP_NO_ERROR) { PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) + while (true) ; } @@ -228,7 +228,7 @@ void AppTask::AppTaskMain(void * pvParameter) sAppTask.Init(); - while (1) + while (true) { /* Task pend until we have stuff to do */ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/PumpManager.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/PumpManager.cpp index 1f35713f20031c..2afc7fd7b37ded 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/PumpManager.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/PumpManager.cpp @@ -35,7 +35,7 @@ int PumpManager::Init() if (NULL == mTimerHandle) { PLAT_LOG("failed to create pump timer"); - while (1) + while (true) ; } diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp index ee81c162b3ff70..6137478fc2ffcc 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -85,13 +85,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp index 41323b44c6faa1..8e29789d2639cd 100644 --- a/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp @@ -91,7 +91,7 @@ CHIP_ERROR AppTask::StartAppTask() if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) != pdPASS) { - while (1) + while (true) ; } @@ -112,35 +112,35 @@ CHIP_ERROR AppTask::Init() CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - while (1) + while (true) ; } ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) { - while (1) + while (true) ; } ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); if (ret != CHIP_NO_ERROR) { - while (1) + while (true) ; } ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - while (1) + while (true) ; } ret = ThreadStackMgrImpl().StartThreadTask(); if (ret != CHIP_NO_ERROR) { - while (1) + while (true) ; } @@ -162,7 +162,7 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - while (1) + while (true) ; } diff --git a/examples/shell/cc13x2x7_26x2x7/main/main.cpp b/examples/shell/cc13x2x7_26x2x7/main/main.cpp index 600b67a3fe4ecf..198e5c906b3f94 100644 --- a/examples/shell/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/shell/cc13x2x7_26x2x7/main/main.cpp @@ -52,7 +52,7 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ extern "C" void vApplicationStackOverflowHook(void) { - while (1) + while (true) { ; } @@ -89,13 +89,13 @@ int main(void) { // can't log until the kernel is started // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) + while (true) ; } vTaskStartScheduler(); // Should never get here. - while (1) + while (true) ; } diff --git a/examples/shell/efr32/src/main.cpp b/examples/shell/efr32/src/main.cpp index 9bb827a3d4ea0c..7a6c59a3ec20bb 100644 --- a/examples/shell/efr32/src/main.cpp +++ b/examples/shell/efr32/src/main.cpp @@ -72,7 +72,7 @@ void appError(int err) { EFR32_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); - while (1) + while (true) ; } diff --git a/examples/tv-casting-app/linux/CastingShellCommands.cpp b/examples/tv-casting-app/linux/CastingShellCommands.cpp index e17053afe8d9f1..ded04e87930dfc 100644 --- a/examples/tv-casting-app/linux/CastingShellCommands.cpp +++ b/examples/tv-casting-app/linux/CastingShellCommands.cpp @@ -76,7 +76,6 @@ void PrintBindings() binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); } - return; } static CHIP_ERROR CastingHandler(int argc, char ** argv) diff --git a/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp b/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp index 9d382a9261c788..f1d023b2632137 100644 --- a/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp +++ b/src/app/clusters/ethernet-network-diagnostics-server/ethernet-network-diagnostics-server.cpp @@ -92,7 +92,7 @@ CHIP_ERROR EthernetDiagosticsAttrAccess::ReadPHYRate(AttributeValueEncoder & aEn CHIP_ERROR EthernetDiagosticsAttrAccess::ReadFullDuplex(AttributeValueEncoder & aEncoder) { Attributes::FullDuplex::TypeInfo::Type fullDuplex; - bool value = 0; + bool value = false; if (DeviceLayer::GetDiagnosticDataProvider().GetEthFullDuplex(value) == CHIP_NO_ERROR) { @@ -110,7 +110,7 @@ CHIP_ERROR EthernetDiagosticsAttrAccess::ReadFullDuplex(AttributeValueEncoder & CHIP_ERROR EthernetDiagosticsAttrAccess::ReadCarrierDetect(AttributeValueEncoder & aEncoder) { Attributes::CarrierDetect::TypeInfo::Type carrierDetect; - bool value = 0; + bool value = false; if (DeviceLayer::GetDiagnosticDataProvider().GetEthCarrierDetect(value) == CHIP_NO_ERROR) { diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp index a25f66915a7525..01979fcb32c521 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -145,7 +145,7 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) emberAfContainsAttribute(endpointId, ModeSelect::Id, ModeSelect::Attributes::OnMode::Id)) { Attributes::OnMode::TypeInfo::Type onMode; - bool onOffValueForStartUp = 0; + bool onOffValueForStartUp = false; if (Attributes::OnMode::Get(endpointId, onMode) == EMBER_ZCL_STATUS_SUCCESS && !emberAfIsKnownVolatileAttribute(endpointId, OnOff::Id, OnOff::Attributes::StartUpOnOff::Id) && OnOffServer::Instance().getOnOffValueForStartUp(endpointId, onOffValueForStartUp) == EMBER_ZCL_STATUS_SUCCESS) diff --git a/src/app/clusters/mode-select-server/supported-modes-manager.h b/src/app/clusters/mode-select-server/supported-modes-manager.h index c7746888e24936..6818d445b298f7 100644 --- a/src/app/clusters/mode-select-server/supported-modes-manager.h +++ b/src/app/clusters/mode-select-server/supported-modes-manager.h @@ -66,7 +66,7 @@ class SupportedModesManager * @param endpointId * @return The mode options provider for the endpoint. */ - virtual const ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const = 0; + virtual ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const = 0; /** * Given the endpointId and a mode value, find the ModeOptionStruct that matches the mode. diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 832e5d7aae982a..8c96c153c7c5b2 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -241,7 +241,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) // 0xff This value cannot happen. // null Set the OnOff attribute to its previous value. - bool onOffValueForStartUp = 0; + bool onOffValueForStartUp = false; EmberAfStatus status = getOnOffValueForStartUp(endpoint, onOffValueForStartUp); if (status == EMBER_ZCL_STATUS_SUCCESS) { @@ -280,7 +280,7 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo if (status == EMBER_ZCL_STATUS_SUCCESS) { // Initialise updated value to 0 - bool updatedOnOff = 0; + bool updatedOnOff = false; status = Attributes::OnOff::Get(endpoint, &updatedOnOff); if (status == EMBER_ZCL_STATUS_SUCCESS) { @@ -289,10 +289,10 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo switch (startUpOnOff.Value()) { case OnOff::OnOffStartUpOnOff::kOff: - updatedOnOff = 0; // Off + updatedOnOff = false; // Off break; case OnOff::OnOffStartUpOnOff::kOn: - updatedOnOff = 1; // On + updatedOnOff = true; // On break; case OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff: updatedOnOff = !updatedOnOff; diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 0c6fe3051f26a8..359ef83a26a9a2 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -1015,7 +1015,7 @@ const EmberAfCluster * emberAfGetClusterByIndex(EndpointId endpoint, uint8_t clu return &(definedEndpoint->endpointType->cluster[clusterIndex]); } -const chip::Span emberAfDeviceTypeListFromEndpoint(chip::EndpointId endpoint, CHIP_ERROR & err) +chip::Span emberAfDeviceTypeListFromEndpoint(chip::EndpointId endpoint, CHIP_ERROR & err) { uint16_t endpointIndex = emberAfIndexFromEndpoint(endpoint); chip::Span ret; diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index 05be4e4884bce6..c977298fe4dcab 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -210,7 +210,7 @@ const EmberAfCluster * emberAfGetClusterByIndex(chip::EndpointId endpoint, uint8 // // Retrieve the device type list associated with a specific endpoint. // -const chip::Span emberAfDeviceTypeListFromEndpoint(chip::EndpointId endpoint, CHIP_ERROR & err); +chip::Span emberAfDeviceTypeListFromEndpoint(chip::EndpointId endpoint, CHIP_ERROR & err); // // Over-ride the device type list current associated with an endpoint with a user-provided list. The buffers backing diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index 7a831a068dc88d..bfb502b65d8d55 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -118,7 +118,6 @@ void CommissionerDiscoveryController::Ok() mUserPrompter->PromptForCommissionPincode(client->GetVendorId(), client->GetProductId(), client->GetDeviceName()); } ChipLogDetail(Controller, "------Via Shell Enter: controller ux ok [pincode]"); - return; } void CommissionerDiscoveryController::CommissionWithPincode(uint32_t pincode) @@ -174,7 +173,6 @@ void CommissionerDiscoveryController::Cancel() } client->SetUDCClientProcessingState(UDCClientProcessingState::kUserDeclined); mPendingConsent = false; - return; } void CommissionerDiscoveryController::CommissioningSucceeded(uint16_t vendorId, uint16_t productId, NodeId nodeId, diff --git a/src/darwin/Framework/CHIP/MTRSetupPayload.mm b/src/darwin/Framework/CHIP/MTRSetupPayload.mm index 786c723768d665..738cb970a92dad 100644 --- a/src/darwin/Framework/CHIP/MTRSetupPayload.mm +++ b/src/darwin/Framework/CHIP/MTRSetupPayload.mm @@ -194,7 +194,7 @@ + (NSNumber *)generateRandomSetupPasscode // again. The chance that this loop does not terminate in a reasonable // amount of time is astronomically low, assuming arc4random_uniform is not // broken. - } while (1); + } while (true); // Not reached. return @(chip::kSetupPINCodeUndefinedValue); diff --git a/src/lib/dnssd/IncrementalResolve.cpp b/src/lib/dnssd/IncrementalResolve.cpp index bfea53353c3036..7131cbfaaf4d88 100644 --- a/src/lib/dnssd/IncrementalResolve.cpp +++ b/src/lib/dnssd/IncrementalResolve.cpp @@ -32,7 +32,7 @@ using namespace mdns::Minimal::Logging; namespace { -const ByteSpan GetSpan(const mdns::Minimal::BytesRange & range) +ByteSpan GetSpan(const mdns::Minimal::BytesRange & range) { return ByteSpan(range.Start(), range.Size()); } diff --git a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp index d585a294fb146e..100fed7a7a1eb5 100644 --- a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp +++ b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp @@ -39,7 +39,7 @@ bool SetMatches(const std::set & set, const std::array expectedContents return false; } - for (auto item : expectedContents) + for (const auto & item : expectedContents) { if (set.find(item) == set.cend()) { diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp index 8f6a16c15fa2fb..d0592a226411da 100644 --- a/src/messaging/ExchangeMgr.cpp +++ b/src/messaging/ExchangeMgr.cpp @@ -358,7 +358,6 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const } SendStandaloneAckIfNeeded(packetHeader, payloadHeader, session, msgFlags, std::move(msgBuf)); - return; } void ExchangeManager::SendStandaloneAckIfNeeded(const PacketHeader & packetHeader, const PayloadHeader & payloadHeader, @@ -394,7 +393,6 @@ void ExchangeManager::SendStandaloneAckIfNeeded(const PacketHeader & packetHeade } // The exchange should be closed inside HandleMessage function. So don't bother close it here. - return; } void ExchangeManager::CloseAllContextsForDelegate(const ExchangeDelegate * delegate) diff --git a/src/platform/DeviceSafeQueue.cpp b/src/platform/DeviceSafeQueue.cpp index ea12becd026918..20e42ae3b8e5d9 100644 --- a/src/platform/DeviceSafeQueue.cpp +++ b/src/platform/DeviceSafeQueue.cpp @@ -40,7 +40,7 @@ bool DeviceSafeQueue::Empty() return mEventQueue.empty(); } -const ChipDeviceEvent DeviceSafeQueue::PopFront() +ChipDeviceEvent DeviceSafeQueue::PopFront() { std::unique_lock lock(mEventQueueLock); diff --git a/src/platform/DeviceSafeQueue.h b/src/platform/DeviceSafeQueue.h index 0e2b311eeae35d..6591a179409482 100644 --- a/src/platform/DeviceSafeQueue.h +++ b/src/platform/DeviceSafeQueue.h @@ -52,7 +52,7 @@ class DeviceSafeQueue void Push(const ChipDeviceEvent & event); bool Empty(); - const ChipDeviceEvent PopFront(); + ChipDeviceEvent PopFront(); private: std::queue mEventQueue; diff --git a/src/platform/EFR32/Logging.cpp b/src/platform/EFR32/Logging.cpp index 0a3d5025bfa4b9..f6c45fe24b4609 100644 --- a/src/platform/EFR32/Logging.cpp +++ b/src/platform/EFR32/Logging.cpp @@ -377,7 +377,7 @@ extern "C" void debugHardfault(uint32_t * sp) snprintf(formattedMsg, sizeof formattedMsg, "PSR 0x%08lx\n", psr); PrintLog(formattedMsg); - while (1) + while (true) ; } diff --git a/src/platform/Infineon/PSOC6/P6Utils.cpp b/src/platform/Infineon/PSOC6/P6Utils.cpp index ac8744382784f0..7f750c4af50612 100644 --- a/src/platform/Infineon/PSOC6/P6Utils.cpp +++ b/src/platform/Infineon/PSOC6/P6Utils.cpp @@ -627,7 +627,7 @@ static void ping_socket() LWIP_ASSERT("setting receive timeout failed", ret == 0); LWIP_UNUSED_ARG(ret); - while (1) + while (true) { if (ping_send(s, ping_target) == ERR_OK) { diff --git a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp index 369cf1c4596aa7..be7a427b57c52a 100644 --- a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp @@ -64,7 +64,7 @@ static int app_get_random(uint8_t * aOutput, size_t aLen) rtn = TRNG_generateEntropy(TRNG_handle_app, &entropyKey); if (rtn != TRNG_STATUS_SUCCESS) { - while (1) + while (true) ; } return 0; @@ -84,7 +84,7 @@ static void app_random_init(void) TRNG_handle_app = TRNG_open(CONFIG_TRNG_APP, &TRNGParams); if (TRNG_handle_app == NULL) { - while (1) + while (true) ; } diff --git a/src/platform/cc32xx/CC32XXConfig.cpp b/src/platform/cc32xx/CC32XXConfig.cpp index e6f30325cb3a80..db570f732cd503 100644 --- a/src/platform/cc32xx/CC32XXConfig.cpp +++ b/src/platform/cc32xx/CC32XXConfig.cpp @@ -432,7 +432,7 @@ CHIP_ERROR CC32XXConfig::FactoryResetConfig() { cc32xxLog("[%s] ", __FUNCTION__); - while (1) + while (true) ; CHIP_ERROR err = CHIP_NO_ERROR; return err; diff --git a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp index e0728be466351b..2f296f74bcf6c5 100644 --- a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.cpp @@ -960,7 +960,7 @@ void BLEManagerImpl::DriveBLEState(intptr_t arg) *******************************************************************************/ void BLEManagerImpl::bleAppTask(void * p_arg) { - while (1) + while (true) { xEventGroupWaitBits(bleAppTaskLoopEvent, LOOP_EV_BLE, true, false, portMAX_DELAY); diff --git a/src/platform/tests/TestConfigurationMgr.cpp b/src/platform/tests/TestConfigurationMgr.cpp index b0259d5fc44bbe..aafdf4a63cfa31 100644 --- a/src/platform/tests/TestConfigurationMgr.cpp +++ b/src/platform/tests/TestConfigurationMgr.cpp @@ -289,7 +289,7 @@ static void TestConfigurationMgr_FirmwareBuildTime(nlTestSuite * inSuite, void * // Verify match. NL_TEST_ASSERT(inSuite, strcmp(date, parsedDate) == 0); NL_TEST_ASSERT(inSuite, strcmp(timeOfDay, parsedTimeOfDay) == 0); - } while (0); + } while (false); // Generate random chip epoch times and verify that our BuildTime.h parser // macros also work for these. diff --git a/src/setup_payload/tests/TestManualCode.cpp b/src/setup_payload/tests/TestManualCode.cpp index ea22bbdaf208ad..43d51f4284df4d 100644 --- a/src/setup_payload/tests/TestManualCode.cpp +++ b/src/setup_payload/tests/TestManualCode.cpp @@ -228,7 +228,7 @@ void TestPayloadParser_FullPayload(nlTestSuite * inSuite, void * inContext) // The same thing, but with dashes separating digit groups. decimalString = "6361-0875-3545-3671-4526"; - decimalString += ComputeCheckChar(decimalString.c_str()); + decimalString += ComputeCheckChar(decimalString); err = ManualSetupPayloadParser(decimalString).populatePayload(payload); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); @@ -309,7 +309,7 @@ void TestPayloadParser_PartialPayload(nlTestSuite * inSuite, void * inContext) // The same thing, but with dashes separating digit groups. decimalString = "236-108753-5"; - decimalString += ComputeCheckChar(decimalString.c_str()); + decimalString += ComputeCheckChar(decimalString); NL_TEST_ASSERT(inSuite, decimalString.length() == 13); err = ManualSetupPayloadParser(decimalString).populatePayload(payload); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);