[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ffsl, ffsll: Work around AIX 7.2 problem
From: |
Bruno Haible |
Subject: |
ffsl, ffsll: Work around AIX 7.2 problem |
Date: |
Mon, 04 Jan 2021 08:05:57 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) |
ffsl and ffsll are declared in <string.h> on glibc (presumably because
<strings.h> is considered outdated).
Whereas in AIX 7.2 they are declared in <strings.h> (presumably because
POSIX specifies that ffs is specified in <strings.h>).
So, code that expects to find ffsl and ffsll in <string.h> fails to
compile on AIX 7.2.
This patch fixes it.
2021-01-04 Bruno Haible <bruno@clisp.org>
ffsl, ffsll: Work around AIX 7.2 problem.
* lib/string.in.h: On AIX, include <strings.h> for the declarations of
ffsl and ffsll.
* doc/glibc-functions/ffsl.texi: Document the AIX 7.2 problem.
* doc/glibc-functions/ffsll.texi: Likewise.
diff --git a/doc/glibc-functions/ffsl.texi b/doc/glibc-functions/ffsl.texi
index 9f8357b..441383c 100644
--- a/doc/glibc-functions/ffsl.texi
+++ b/doc/glibc-functions/ffsl.texi
@@ -11,6 +11,10 @@ Portability problems fixed by Gnulib:
@item
This function is missing on some platforms:
FreeBSD 5.2.1, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX
6.5, Solaris 10, Cygwin 1.7.x, mingw, MSVC 14, Android 9.0.
+@item
+This function is declared in @code{<strings.h>} instead of @code{<string.h>}
+on some platforms:
+AIX 7.2.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/doc/glibc-functions/ffsll.texi b/doc/glibc-functions/ffsll.texi
index a8493a9..718ccfc 100644
--- a/doc/glibc-functions/ffsll.texi
+++ b/doc/glibc-functions/ffsll.texi
@@ -11,6 +11,10 @@ Portability problems fixed by Gnulib:
@item
This function is missing on many non-glibc platforms:
Mac OS X 10.5, FreeBSD 6.0, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 5.1,
HP-UX 11, IRIX 6.5, Solaris 10, Cygwin 1.7.x, mingw, MSVC 14, Android 9.0.
+@item
+This function is declared in @code{<strings.h>} instead of @code{<string.h>}
+on some platforms:
+AIX 7.2.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/lib/string.in.h b/lib/string.in.h
index c32fd36..2f2e07b 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -69,6 +69,14 @@
# include <unistd.h>
#endif
+/* AIX 7.2 declares ffsl and ffsll in <strings.h>, not in <string.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
+ && defined _AIX) \
+ && ! defined __GLIBC__
+# include <strings.h>
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ffsl, ffsll: Work around AIX 7.2 problem,
Bruno Haible <=