bug-gnulib
[Top][All Lists]
Advanced

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

sys_socket: Fix compilation errors in C++ mode on AIX 7.3 with gcc


From: Bruno Haible
Subject: sys_socket: Fix compilation errors in C++ mode on AIX 7.3 with gcc
Date: Fri, 18 Aug 2023 17:26:21 +0200

On AIX 7.3.1 with gcc, I see these compilation errors:

../gllib/sys/socket.h:874:1: error: conflicting declaration of 'int accept(int, 
sockaddr*, socklen_t*)' with 'C' linkage
  874 | _GL_CXXALIASWARN (accept);
      | ^~~~~~~~~~~~~~~~
...
../gllib/sys/socket.h:936:1: error: conflicting declaration of 'int 
getpeername(int, sockaddr*, socklen_t*)' with 'C' linkage
  936 | _GL_CXXALIASWARN (getpeername);
      | ^~~~~~~~~~~~~~~~
...
../gllib/sys/socket.h:968:1: error: conflicting declaration of 'int 
getsockname(int, sockaddr*, socklen_t*)' with 'C' linkage
  968 | _GL_CXXALIASWARN (getsockname);
      | ^~~~~~~~~~~~~~~~
...
../gllib/sys/socket.h:1115:1: error: conflicting declaration of 'ssize_t 
recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*)' with 'C' linkage
 1115 | _GL_CXXALIASWARN (recvfrom);
      | ^~~~~~~~~~~~~~~~

This patch fixes them, as usual for this type of error.


2023-08-18  Bruno Haible  <bruno@clisp.org>

        sys_socket: Fix compilation errors in C++ mode on AIX 7.3 with gcc.
        * lib/sys_socket.in.h (accept, getpeername, getsockname, recvfrom):
        Disable _GL_CXXALIASWARN invocation on non-glibc systems.

diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index afeedf070c..62211e475c 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -358,7 +358,9 @@ _GL_CXXALIAS_SYS_CAST (accept, int,
                         struct sockaddr *restrict addr,
                         socklen_t *restrict addrlen));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (accept);
+# endif
 #elif @HAVE_WINSOCK2_H@
 # undef accept
 # define accept accept_used_without_requesting_gnulib_module_accept
@@ -420,7 +422,9 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int,
                        (int fd, struct sockaddr *restrict addr,
                         socklen_t *restrict addrlen));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getpeername);
+# endif
 #elif @HAVE_WINSOCK2_H@
 # undef getpeername
 # define getpeername 
getpeername_used_without_requesting_gnulib_module_getpeername
@@ -452,7 +456,9 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int,
                        (int fd, struct sockaddr *restrict addr,
                         socklen_t *restrict addrlen));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getsockname);
+# endif
 #elif @HAVE_WINSOCK2_H@
 # undef getsockname
 # define getsockname 
getsockname_used_without_requesting_gnulib_module_getsockname
@@ -599,7 +605,9 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
                         struct sockaddr *restrict from,
                         socklen_t *restrict fromlen));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (recvfrom);
+# endif
 #elif @HAVE_WINSOCK2_H@
 # undef recvfrom
 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom






reply via email to

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