aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2024-05-22 08:18:26 +0000
committerAndrew Turner <andrew@FreeBSD.org>2024-05-22 08:18:26 +0000
commit940155d24afb5c80ce7fde59c856c5c0d5c6dbe1 (patch)
treefa191c38c245365634e8acc744b282219dd72082
parent53120fbb68952b7d620c2c0e1cf05c5017fc1b27 (diff)
sys/sys: Fix __builtin_is_aligned fallback
When the compiler doesn't provide __builtin_is_aligned we use macro as a fallback. The macro was missing brackets around one argument. This could lead to incorrect results when the argument is more complex than a single stagement. Fix this by adding the needed brackets. Reviewed by: brooks, imp, jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45260
-rw-r--r--sys/sys/cdefs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index a6545a29a302..037dfa55f923 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -902,7 +902,7 @@
/* Provide fallback versions for other compilers (GCC/Clang < 10): */
#if !__has_builtin(__builtin_is_aligned)
#define __builtin_is_aligned(x, align) \
- (((__uintptr_t)x & ((align) - 1)) == 0)
+ (((__uintptr_t)(x) & ((align) - 1)) == 0)
#endif
#if !__has_builtin(__builtin_align_up)
#define __builtin_align_up(x, align) \