fix(posix): parenthesize PX4_STACK_ADJUSTED and ERROR macros

bugprone-macro-parentheses flagged both: PX4_STACK_ADJUSTED(_s)
expanded its argument bare into an expression with `*` and `>>`, and
the ERROR shim defined `-1` without grouping parens. Add the missing
parens so caller-side expressions like `PX4_STACK_ADJUSTED(a + b)` and
`x - ERROR` keep their intended precedence.

Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
Nuno Marques
2026-05-07 16:37:39 -07:00
parent d331137c56
commit b74f54be4c
2 changed files with 2 additions and 2 deletions
@@ -131,7 +131,7 @@ __END_DECLS
// we often run out of stack space when pointers are larger than 4 bytes.
// Double the stack size on posix when we're on a 64-bit architecture.
// Most full-scale OS use 1-4K of memory from the stack themselves
#define PX4_STACK_ADJUSTED(_s) (_s * (sizeof(void *) >> 2) + PX4_STACK_OVERHEAD)
#define PX4_STACK_ADJUSTED(_s) ((_s) * (sizeof(void *) >> 2) + PX4_STACK_OVERHEAD)
__BEGIN_DECLS
+1 -1
View File
@@ -103,7 +103,7 @@
#undef ERROR
#endif
#if defined(__PX4_POSIX)
#define ERROR -1
#define ERROR (-1)
#endif
#ifdef IGNORE
#undef IGNORE