This is an automated email from the ASF dual-hosted git repository.
lupyuen pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.0 by this push:
new e041bc7cdc0 include/nuttx/semaphore.h: parenthesize NXSEM helper args
e041bc7cdc0 is described below
commit e041bc7cdc023e41e5cf8d7b0af0f3f916f884ae
Author: shichunma <[email protected]>
AuthorDate: Fri Jun 5 17:09:09 2026 +0800
include/nuttx/semaphore.h: parenthesize NXSEM helper args
Wrap the NXSEM_COUNT() and NXSEM_MHOLDER() macro arguments in an extra pair
of parentheses before member access.
This makes the helpers safer for complex expressions passed as the macro
argument and aligns them with common macro style.
Signed-off-by: Jerry Ma <[email protected]>
---
include/nuttx/semaphore.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h
index fdf32534f46..769da8baa4b 100644
--- a/include/nuttx/semaphore.h
+++ b/include/nuttx/semaphore.h
@@ -61,7 +61,7 @@
/* Macros to retrieve sem count and to check if nxsem is mutex */
-#define NXSEM_COUNT(s) ((FAR atomic_t *)&(s)->val.semcount)
+#define NXSEM_COUNT(s) ((FAR atomic_t *)&((s)->val.semcount))
#define NXSEM_IS_MUTEX(s) (((s)->flags & SEM_TYPE_MUTEX) != 0)
/* Mutex related helper macros */
@@ -72,7 +72,7 @@
/* Macro to retrieve mutex's atomic holder's ptr */
-#define NXSEM_MHOLDER(s) ((FAR atomic_t *)&(s)->val.mholder)
+#define NXSEM_MHOLDER(s) ((FAR atomic_t *)&((s)->val.mholder))
/* Check if holder value (TID) is not NO_HOLDER or RESET */