From: Bruno Haible <bruno@clisp.org>
Date: Sun, 8 Dec 2019 20:49:32 +0000 (+0100)
Subject: Fix compilation error in C++ mode on HP-UX 11.
X-Git-Tag: v1.0~4538
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=16e9d079c99026d6807ab3a42bb2175593f6dbc2;p=gnulib.git

Fix compilation error in C++ mode on HP-UX 11.

* lib/unistd.in.h (getpagesize): Declare on HP-UX.
* doc/glibc-functions/getpagesize.texi: Mention the HP-UX problem.
---

diff --git a/ChangeLog b/ChangeLog
index 7b468512e1..903e56c236 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-08  Bruno Haible  <bruno@clisp.org>
+
+	Fix compilation error in C++ mode on HP-UX 11.
+	* lib/unistd.in.h (getpagesize): Declare on HP-UX.
+	* doc/glibc-functions/getpagesize.texi: Mention the HP-UX problem.
+
 2019-12-08  Bruno Haible  <bruno@clisp.org>
 
 	Fix compilation errors on HP-UX 11/ia64.
diff --git a/doc/glibc-functions/getpagesize.texi b/doc/glibc-functions/getpagesize.texi
index 74273baa20..1538a1ec39 100644
--- a/doc/glibc-functions/getpagesize.texi
+++ b/doc/glibc-functions/getpagesize.texi
@@ -23,6 +23,9 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 MSVC 14, Android 4.4.
 @item
+This function is not declared on some platforms:
+HP-UX 11 with compiler option @code{-D_XOPEN_SOURCE=600}.
+@item
 This function is broken on some platforms:
 mingw.
 @end itemize
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 2fa25b4a75..c57d6f9ff3 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -905,6 +905,11 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
 _GL_FUNCDECL_RPL (getpagesize, int, (void));
 _GL_CXXALIAS_RPL (getpagesize, int, (void));
 # else
+/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
+   the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used.  */
+#  if defined __hpux
+_GL_FUNCDECL_SYS (getpagesize, int, (void));
+#  endif
 #  if !@HAVE_GETPAGESIZE@
 #   if !defined getpagesize
 /* This is for POSIX systems.  */