mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
#undef ERROR
|
||||
#endif
|
||||
#if defined(__PX4_POSIX)
|
||||
#define ERROR -1
|
||||
#define ERROR (-1)
|
||||
#endif
|
||||
#ifdef IGNORE
|
||||
#undef IGNORE
|
||||
|
||||
Reference in New Issue
Block a user