[PATCH v2] NAN: Use a portable os_ffs() instead of ffs()
Jouni Malinen
j at w1.fi
Sat Oct 24 09:09:43 PDT 2026
On Fri, Sep 11, 2026 at 02:16:03AM +0530, Chaitanya Tata wrote:
> ffs() is declared in <strings.h> only when __MISC_VISIBLE,
> __XSI_VISIBLE >= 700 or __POSIX_VISIBLE < 200809 (glibc and picolibc
> both use this scheme). Building with _POSIX_C_SOURCE=200809L and
> without _DEFAULT_SOURCE/_XOPEN_SOURCE, a legitimate and fairly common
> strict-POSIX build configuration, therefore hides the declaration and
> fails with an implicit-function-declaration error.
>
> Add a portable os_ffs() to os.h: __builtin_ffs() on GCC/clang,
> _BitScanForward() on MSVC (matching the _MSC_VER handling already
> used throughout this header), and a manual bit-scan fallback
> otherwise. Use it in place of ffs() in the NAN code.
Thanks, applied.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list