git: 940155d24afb - main - sys/sys: Fix __builtin_is_aligned fallback
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 May 2024 08:31:59 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=940155d24afb5c80ce7fde59c856c5c0d5c6dbe1 commit 940155d24afb5c80ce7fde59c856c5c0d5c6dbe1 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-05-22 08:18:26 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-05-22 08:18:26 +0000 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 --- sys/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) \