summaryrefslogtreecommitdiff
path: root/lib/strings.in.h
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-07-11 17:05:34 -0600
committerEric Blake <eblake@redhat.com>2011-07-11 17:18:25 -0600
commita918da4d61d28be61a12605c9d35e2cf3966d866 (patch)
tree551dbebe9645bf51d4de6c7828bcebffca92ae4e /lib/strings.in.h
parent00a829e20e9bdb52d1b68357669ea248ed6661f1 (diff)
downloadgnulib-a918da4d61d28be61a12605c9d35e2cf3966d866.tar.gz
ffs: new module
Libvirt wants to use ffs() to avoid dragging in -lm for log2(). * modules/ffs: New file. * m4/ffs.m4: Likewise. * lib/ffs.c: Likewise. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_DEFAULTS): Add default. * modules/strings (Makefile.am): Substitute witness. (Depends-on): Add c++defs. * lib/strings.in.h (ffs): Declare. * modules/ffs-tests: New test file. * tests/test-ffs.c: Test new module. * MODULES.html.sh (Integer arithmetic functions): Mention it. * doc/posix-functions/ffs.texi (ffs): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'lib/strings.in.h')
-rw-r--r--lib/strings.in.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/strings.in.h b/lib/strings.in.h
index ba5a1d8943..647903ad6a 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -30,6 +30,8 @@
#define _@GUARD_PREFIX@_STRINGS_H
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
@@ -39,6 +41,20 @@ extern "C" {
#endif
+ /* Find the index of the least-significant set bit. */
+#if @GNULIB_FFS@
+# if !@HAVE_FFS@
+_GL_FUNCDECL_SYS (ffs, int, (int i));
+# endif
+_GL_CXXALIAS_SYS (ffs, int, (int i));
+_GL_CXXALIASWARN (ffs);
+#elif defined GNULIB_POSIXCHECK
+# undef ffs
+# if HAVE_RAW_DECL_FFS
+_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
+# endif
+#endif
+
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.