From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] fixup! range: fix corner cases when exclusive end is zero
Date: Sat, 1 Nov 2025 12:07:31 +0100 [thread overview]
Message-ID: <20251101110732.3835886-1-a.fatoum@barebox.org> (raw)
In-Reply-To: <20251101105542.3830943-1-a.fatoum@barebox.org>
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@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
prev parent reply other threads:[~2025-11-01 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-01 10:55 [PATCH master 1/2] " Ahmad Fatoum
2025-11-01 10:55 ` [PATCH master 2/2] test: self: add range.h test Ahmad Fatoum
2025-11-01 11:07 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251101110732.3835886-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox