diff --git a/include/nuttx/cancelpt.h b/include/nuttx/cancelpt.h index 052c43430dc..74a4336b3fc 100644 --- a/include/nuttx/cancelpt.h +++ b/include/nuttx/cancelpt.h @@ -63,9 +63,9 @@ * Pre-processor Definitions ****************************************************************************/ -#define CANCEL_FLAG_NONCANCELABLE (1 << 0) /* Pthread is non-cancelable */ -#define CANCEL_FLAG_CANCEL_ASYNC (1 << 1) /* Async (vs deferred) cancellation type */ -#define CANCEL_FLAG_CANCEL_PENDING (1 << 2) /* Pthread cancel is pending */ +#define CANCEL_FLAG_NONCANCELABLE (1u << 0) /* Pthread is non-cancelable */ +#define CANCEL_FLAG_CANCEL_ASYNC (1u << 1) /* Async (vs deferred) cancellation type */ +#define CANCEL_FLAG_CANCEL_PENDING (1u << 2) /* Pthread cancel is pending */ /**************************************************************************** * Public Function Prototypes diff --git a/libs/libc/sched/task_cancelpt.c b/libs/libc/sched/task_cancelpt.c index debee81e791..507b8bda9cd 100644 --- a/libs/libc/sched/task_cancelpt.c +++ b/libs/libc/sched/task_cancelpt.c @@ -106,13 +106,13 @@ bool enter_cancellation_point(void) * nesting level. */ - if (((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0 && - (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0) || + if (((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0u && + (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0u) || tls->tl_cpcount > 0) { /* Check if there is a pending cancellation */ - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0u) { /* Yes... return true (if we don't exit here) */ @@ -194,7 +194,7 @@ void leave_cancellation_point(void) * the type of the thread. */ - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0u) { #ifndef CONFIG_DISABLE_PTHREAD pthread_exit(PTHREAD_CANCELED); @@ -245,13 +245,13 @@ bool check_cancellation_point(void) * cancellation and will true if there is a pending cancellation. */ - if (((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0 && - (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0) || + if (((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0u && + (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0u) || tls->tl_cpcount > 0) { /* Check if there is a pending cancellation. If so, return true. */ - ret = ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0); + ret = ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0u); } return ret; diff --git a/libs/libc/sched/task_setcancelstate.c b/libs/libc/sched/task_setcancelstate.c index ad5cc23870f..2c20d7eaa40 100644 --- a/libs/libc/sched/task_setcancelstate.c +++ b/libs/libc/sched/task_setcancelstate.c @@ -71,7 +71,7 @@ int task_setcancelstate(int state, FAR int *oldstate) if (oldstate != NULL) { - if ((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) != 0u) { *oldstate = TASK_CANCEL_DISABLE; } @@ -91,12 +91,12 @@ int task_setcancelstate(int state, FAR int *oldstate) /* Check if a cancellation was pending */ - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0u) { #ifdef CONFIG_CANCELLATION_POINTS /* If we are using deferred cancellation? */ - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) != 0u) #endif { /* No.. We are using asynchronous cancellation. If the diff --git a/libs/libc/sched/task_setcanceltype.c b/libs/libc/sched/task_setcanceltype.c index f151d204aeb..d748e6e02fb 100644 --- a/libs/libc/sched/task_setcanceltype.c +++ b/libs/libc/sched/task_setcanceltype.c @@ -63,7 +63,7 @@ int task_setcanceltype(int type, FAR int *oldtype) if (oldtype != NULL) { - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) != 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) != 0u) { *oldtype = TASK_CANCEL_ASYNCHRONOUS; } @@ -86,8 +86,8 @@ int task_setcanceltype(int type, FAR int *oldtype) * cancellation is pending, then exit now. */ - if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0 && - (tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0) + if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_PENDING) != 0u && + (tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) == 0u) { tls->tl_cpstate &= ~CANCEL_FLAG_CANCEL_PENDING; diff --git a/sched/task/task_cancelpt.c b/sched/task/task_cancelpt.c index 6440170ada2..4f6d44a57c7 100644 --- a/sched/task/task_cancelpt.c +++ b/sched/task/task_cancelpt.c @@ -109,7 +109,7 @@ bool nxnotify_cancellation(FAR struct tcb_s *tcb) /* Check to see if this task has the non-cancelable bit set. */ if ((tcb->flags & TCB_FLAG_FORCED_CANCEL) == 0 && - (tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) != 0) + (tls->tl_cpstate & CANCEL_FLAG_NONCANCELABLE) != 0u) { /* Then we cannot cancel the thread now. Here is how this is * supposed to work: @@ -131,7 +131,7 @@ bool nxnotify_cancellation(FAR struct tcb_s *tcb) #ifdef CONFIG_CANCELLATION_POINTS /* Check if this task supports deferred cancellation */ - if (!ret && (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0) + if (!ret && (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0u) { /* Then we cannot cancel the task asynchronously. */