diff mbox series

[U-Boot] bch: don't use __BSD_VISIBLE to test for fls

Message ID 20170827104514.77150-1-jsg@jsg.id.au
State Accepted
Commit 8f1603bd78a31f52927d398f600e47e2452997a6
Delegated to: Tom Rini
Headers show
Series [U-Boot] bch: don't use __BSD_VISIBLE to test for fls | expand

Commit Message

Jonathan Gray Aug. 27, 2017, 10:45 a.m. UTC
Commit 4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d assumes fls is in libc
if __BSD_VISIBLE is defined.  This appears to only be true on FreeBSD
and DragonFlyBSD.  OpenBSD defines __BSD_VISIBLE and does not have fls
in strings.h/libc.

Switch the test for __BSD_VISIBLE to one for __DragonFly__ and
__FreeBSD__ to unbreak the build on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
 lib/bch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Sept. 4, 2017, 12:42 a.m. UTC | #1
On Sun, Aug 27, 2017 at 08:45:14PM +1000, Jonathan Gray wrote:

> Commit 4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d assumes fls is in libc
> if __BSD_VISIBLE is defined.  This appears to only be true on FreeBSD
> and DragonFlyBSD.  OpenBSD defines __BSD_VISIBLE and does not have fls
> in strings.h/libc.
> 
> Switch the test for __BSD_VISIBLE to one for __DragonFly__ and
> __FreeBSD__ to unbreak the build on OpenBSD.
> 
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/lib/bch.c b/lib/bch.c
index 7a2d9d3b86..d0d7e25c4e 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -117,7 +117,7 @@  struct gf_poly_deg1 {
 };
 
 #ifdef USE_HOSTCC
-#ifndef __BSD_VISIBLE
+#if !defined(__DragonFly__) && !defined(__FreeBSD__)
 static int fls(int x)
 {
 	int r = 32;