This is an automated email from the ASF dual-hosted git repository.
linguini1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 207fa5b0e2b include/nuttx/semaphore.h: parenthesize NXSEM helper args
207fa5b0e2b is described below
commit 207fa5b0e2b4c1c9725b00b66e3a6fac54025f84
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 */