]> Savannah Git Hosting - gnulib.git/commitdiff
unistd: Avoid compilation error in C++ mode on Solaris, HP-UX, mingw.
authorBruno Haible <bruno@clisp.org>
Sun, 20 Jun 2021 15:18:26 +0000 (17:18 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 20 Jun 2021 15:18:26 +0000 (17:18 +0200)
Reported by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00135.html>.

* lib/unistd.in.h (swab): Consider different declarations on Solaris,
HP-UX, and old mingw.

ChangeLog
lib/unistd.in.h

index 5fc5907aae7f253c643736e4f9aa8b0d26ddaac0..eee09cd52254322e47a72298f8da41279bbba1b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-06-20  Bruno Haible  <bruno@clisp.org>
+
+       unistd: Avoid compilation error in C++ mode on Solaris, HP-UX, mingw.
+       Reported by Eli Zaretskii <eliz@gnu.org> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00135.html>.
+       * lib/unistd.in.h (swab): Consider different declarations on Solaris,
+       HP-UX, and old mingw.
+
 2021-06-20  Bruno Haible  <bruno@clisp.org>
 
        Sync with GNU gettext.
index d4d4ba7743108a50ae1ca5846b7a46a0ae2b648b..73c882f97ba868d9c587fd536dfd96125d8d4a21 100644 (file)
@@ -2034,9 +2034,17 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #   undef swab
 #   define swab _swab
 #  endif
-_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
-# else
+/* Need to cast, because in old mingw the arguments are
+                             (const char *from, char *to, size_t n).  */
+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
+# else
+#  if defined __hpux /* HP-UX */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
+#  elif defined __sun && !defined _XPG4 /* Solaris */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
+#  else
 _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
+#  endif
 # endif
 _GL_CXXALIASWARN (swab);
 #endif