[PATCH] fixup! range: fix corner cases when exclusive end is zero
Ahmad Fatoum
a.fatoum at barebox.org
Sat Nov 1 04:07:31 PDT 2025
While there is no risk of miscomputation here, let's avoid possible
compile errors by putting parenthesis around macro arguments as usual.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
include/range.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/range.h b/include/range.h
index eb75486d9add..b5dc5cdb4d39 100644
--- a/include/range.h
+++ b/include/range.h
@@ -40,9 +40,9 @@ static inline bool region_overlap_end_inclusive(u64 starta, u64 enda,
u64 __starta = (starta), __enda = (enda) - 1; \
u64 __startb = (startb), __endb = (endb) - 1; \
\
- static_assert(__same_type(starta, enda)); \
- static_assert(__same_type(enda, startb)); \
- static_assert(__same_type(startb, endb)); \
+ static_assert(__same_type((starta), (enda))); \
+ static_assert(__same_type((enda), (startb))); \
+ static_assert(__same_type((startb), (endb))); \
static_assert(((typeof(endb))-1) > 0); \
\
/* Empty ranges don't overlap */ \
--
2.47.3
More information about the barebox
mailing list