From ec5187624df26c48d82a6b62a875c2531ded1b6e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 5 Apr 2010 18:34:08 +0200 Subject: [PATCH] sys_socket: Avoid #define replacements in C++ mode. --- ChangeLog | 7 +++++++ lib/sys_socket.in.h | 27 +++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 055f3c03c0..8a42bbc0fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-05 Bruno Haible + + sys_socket: Avoid #define replacements in C++ mode. + * lib/sys_socket.in.h (close, gethostname, select): In C++, attach a + warning to the function if possible, rather than #defining the symbol + to a dysfunctional alias. + 2010-04-05 Bruno Haible fseeko: Fix C++ test error on mingw. diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index 03579af8b0..c4daaacf6f 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -183,13 +183,23 @@ rpl_fd_isset (SOCKET fd, fd_set * set) /* Wrap everything else to use libc file descriptors for sockets. */ #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H -# undef close -# define close close_used_without_including_unistd_h +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef close +# define close close_used_without_including_unistd_h +# else + _GL_WARN_ON_USE (close, + "close() used without including "); +# endif #endif #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H -# undef gethostname -# define gethostname gethostname_used_without_including_unistd_h +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gethostname +# define gethostname gethostname_used_without_including_unistd_h +# else + _GL_WARN_ON_USE (gethostname, + "gethostname() used without including "); +# endif #endif #if @GNULIB_SOCKET@ @@ -571,8 +581,13 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " #endif #if @HAVE_WINSOCK2_H@ -# undef select -# define select select_used_without_including_sys_select_h +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef select +# define select select_used_without_including_sys_select_h +# else + _GL_WARN_ON_USE (select, + "select() used without including "); +# endif #endif #if @GNULIB_ACCEPT4@ -- 2.30.2