Some toolchain has fls() definition in string.h as argument type int,
which is conflicting uint32_t argument type.

/export/dpdk.org/lib/librte_eal/common/rte_reciprocal.c:47:19:
error: conflicting types for ‘fls’
 static inline int fls(uint32_t x)
                  ^~~

/opt/marvell-tools-201/aarch64-marvell-elf/include/strings.h:59:6:
note: previous declaration of ‘fls’ was here
 int  fls(int) __pure2;

FreeBSD string.h also has fls() with argument as int type.
https://www.freebsd.org/cgi/man.cgi?query=fls&sektion=3

Fixing the conflict by renaming internal function as __fls

Fixes: ffe3ec811ef5 ("sched: introduce reciprocal divide")
Cc: sta...@dpdk.org

Signed-off-by: Jerin Jacob <jerin.ja...@caviumnetworks.com>
---
 lib/librte_eal/common/rte_reciprocal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/rte_reciprocal.c 
b/lib/librte_eal/common/rte_reciprocal.c
index d81b11db6..f2c7453d2 100644
--- a/lib/librte_eal/common/rte_reciprocal.c
+++ b/lib/librte_eal/common/rte_reciprocal.c
@@ -44,7 +44,7 @@
 /* find largest set bit.
  * portable and slow but does not matter for this usage.
  */
-static inline int fls(uint32_t x)
+static inline int __fls(uint32_t x)
 {
        int b;
 
@@ -62,7 +62,7 @@ struct rte_reciprocal rte_reciprocal_value(uint32_t d)
        uint64_t m;
        int l;
 
-       l = fls(d - 1);
+       l = __fls(d - 1);
        m = ((1ULL << 32) * ((1ULL << l) - d));
        m /= d;
 
-- 
2.19.1

Reply via email to