From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal: fix build issue Date: Tue, 06 Nov 2018 21:27:19 +0100 Message-ID: <59314752.LC5aAjuh3R@xps> References: <20181106114435.14770-1-jerin.jacob@caviumnetworks.com> <3520386.84pXejHKmD@xps> <20181106133127.GA29301@jerin> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Jacob, Jerin" , "stable@dpdk.org" To: Jerin Jacob Return-path: In-Reply-To: <20181106133127.GA29301@jerin> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 06/11/2018 14:31, Jerin Jacob: > From: Thomas Monjalon > > 06/11/2018 12:45, Jerin Jacob: > > > 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 =E2=80=98fls=E2=80=99 > > > static inline int fls(uint32_t x) > > > ^~~ > > > > > > /opt/marvell-tools-201/aarch64-marvell-elf/include/strings.h:59:6: > > > note: previous declaration of =E2=80=98fls=E2=80=99 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=3Dfls&sektion=3D3 > > > > > > Fixing the conflict by renaming internal function as __fls > >=20 > > Why not rte_fls? Would it be more future proof? >=20 > Agreed. There are two instance of fls in dpdk code base now, >=20 > 1) lib/librte_eal/common/rte_reciprocal.c takes uint32_t > 2) drivers/net/fm10k/fm10k_ethdev.c has macro, used with uint16_t as > argument. >=20 > Should we make it as macro or follow libc prototype where argument is > int. >=20 > Something like below, >=20 > static inline int > rte_fls(int x) > { > return (x =3D=3D 0) ? 0 : sizeof(x) * 8 - __builtin_clz(x); > } I tend to think that using uint32_t parameter would be more useful in DPDK.