bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getdomainname: Fix compilation error in C++ mode on Solaris 11


From: Bruno Haible
Subject: getdomainname: Fix compilation error in C++ mode on Solaris 11
Date: Fri, 02 Sep 2022 19:53:57 +0200

A gnulib testdir produces a compilation error on Solaris 11 OmniOS and
Solaris 11 OpenIndiana:

In file included from /usr/include/sys/time.h:489,
                 from ../gllib/sys/time.h:39,
                 from /usr/include/sys/select.h:53,
                 from ../gllib/sys/select.h:36,
                 from /usr/include/sys/types.h:640,
                 from ../gllib/sys/types.h:39,
                 from ../gllib/fcntl.h:56,
                 from ../../gltests/test-fcntl-h-c++.cc:22:
../gllib/unistd.h:1653:1: error: 'getdomainname' was not declared in this 
scope; did you mean 'gnulib::getdomainname'?
 1653 | _GL_CXXALIASWARN (getdomainname);
      | ^~~~~~~~~~~~~~~~
../gllib/unistd.h:1645:1: note: 'gnulib::getdomainname' declared here
 1645 | _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
      | ^~~~~~~~~~~~~~~~
gmake[4]: *** [Makefile:23125: test-fcntl-h-c++.o] Error 1

The reason is that on these platforms (and also on AIX, Android, and native
Windows) this function is not declared, therefore one cannot attach a warning
to it. This patch fixes it.


2022-09-02  Bruno Haible  <bruno@clisp.org>

        getdomainname: Fix compilation error in C++ mode on Solaris 11.
        * lib/unistd.in.h (getdomainname): Enable the C++ alias warning only on
        glibc systems.

diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 57df09ecdf..ef3e68fcd2 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1143,7 +1143,9 @@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t 
len)
 #  endif
 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getdomainname);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
 # if HAVE_RAW_DECL_GETDOMAINNAME






reply via email to

[Prev in Thread] Current Thread [Next in Thread]