Fix clang-tidy warnings (#4359)

The warnings included recommendations of braces for if statement
readability, a recommendation for default initialization of an int
array, and include-what-you-use (indirectly through clang-tidy reporting
undefined symbols).
This commit is contained in:
Tyler Veness
2022-08-17 19:53:56 -07:00
committed by GitHub
parent ea6b1d8449
commit a2a5c926b6
15 changed files with 84 additions and 42 deletions

View File

@@ -113,8 +113,9 @@ static void notifierThreadMain() {
if (!notifierRunning) {
break;
}
if (triggeredMask == 0)
if (triggeredMask == 0) {
continue;
}
alarmCallback();
}
}
@@ -195,8 +196,9 @@ void HAL_SetNotifierName(HAL_NotifierHandle notifierHandle, const char* name,
void HAL_StopNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
auto notifier = notifierHandles->Get(notifierHandle);
if (!notifier)
if (!notifier) {
return;
}
{
std::scoped_lock lock(notifier->mutex);
@@ -209,8 +211,9 @@ void HAL_StopNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
auto notifier = notifierHandles->Free(notifierHandle);
if (!notifier)
if (!notifier) {
return;
}
// Just in case HAL_StopNotifier() wasn't called...
{
@@ -244,8 +247,9 @@ void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
uint64_t triggerTime, int32_t* status) {
auto notifier = notifierHandles->Get(notifierHandle);
if (!notifier)
if (!notifier) {
return;
}
{
std::scoped_lock lock(notifier->mutex);
@@ -270,8 +274,9 @@ void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle,
int32_t* status) {
auto notifier = notifierHandles->Get(notifierHandle);
if (!notifier)
if (!notifier) {
return;
}
{
std::scoped_lock lock(notifier->mutex);
@@ -282,8 +287,9 @@ void HAL_CancelNotifierAlarm(HAL_NotifierHandle notifierHandle,
uint64_t HAL_WaitForNotifierAlarm(HAL_NotifierHandle notifierHandle,
int32_t* status) {
auto notifier = notifierHandles->Get(notifierHandle);
if (!notifier)
if (!notifier) {
return 0;
}
std::unique_lock lock(notifier->mutex);
notifier->cond.wait(lock, [&] {
return !notifier->active || notifier->triggeredTime != UINT64_MAX;