[PATCH 2/2] devtools: forbid the use of ffs compiler builtins
Mattias Rönnblom
hofors at lysator.liu.se
Thu Oct 17 07:50:06 CEST 2024
On 2024-10-16 17:04, Stephen Hemminger wrote:
> On Wed, 16 Oct 2024 15:54:11 +0200
> Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:
>
>> Extend checkpatches.sh to detect the use of __builtin_(ffs|ffsll).
>>
>> These intrinsics are not available in MSVC, and there are perfectly
>> serviceable alternatives in <rte_bitops.h>.
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom at ericsson.com>
>> Suggested-by: David Marchand <david.marchand at redhat.com>
>
> Shouldn't this apply to all _builtin_ functions.
>
Aren̈́'t GCC builtins pretty much standard? So any driver not targeting
Windows should be fine, although it would be better to use a DPDK wrapper.
> There are a lot of drivers still doing this.
I would suggest we fix this when someone has taken the time to
improve/modernize/extend <rte_bitops.h> further (e.g., with _Generic
versions of all bit fiddling and count functions and "all" __builtins
are covered).
I guess other APIs also may need to be extended (for non-bitops builtins).
More information about the dev
mailing list