This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 19d16d87a1ea1d3ead8d08e6fb19cc40b307a738
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 19:31:38 2026 +0200

    include/string.h: Declare ffs(), ffsl() and ffsll().
    
    POSIX puts ffs(), ffsl() and ffsll() in <strings.h>, but other C
    libraries also declare them in <string.h>, and some programs include
    only <string.h>.  A configure check can find ffsl() in libc and assume
    that <string.h> declares it: such a program then fails with an implicit
    declaration of ffsl().
    
    Declare the three functions in <string.h> too, next to strcasecmp() and
    strncasecmp(), which are there for the same reason.  The names are in
    parentheses, so the function-like macros of <strings.h> do not expand
    them.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/string.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/string.h b/include/string.h
index 8492d1fd393..2738eb8cb44 100644
--- a/include/string.h
+++ b/include/string.h
@@ -82,6 +82,12 @@ int        strncmp(FAR const char *, FAR const char *, 
size_t);
 int        strcasecmp(FAR const char *, FAR const char *);
 int        strncasecmp(FAR const char *, FAR const char *, size_t);
 
+/* The parentheses keep the function-like macros of <strings.h> out */
+
+int        (ffs)(int j);
+int        (ffsl)(long j);
+int        (ffsll)(long long j);
+
 int        strcoll(FAR const char *, FAR const char *s2);
 FAR char  *strcpy(FAR char *dest, FAR const char *src);
 FAR char  *stpcpy(FAR char *dest, FAR const char *src);

Reply via email to