Mercurial > gnulib
changeset 13170:9b99814e369a
sys_socket: Avoid #define replacements in C++ mode.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 05 Apr 2010 18:34:08 +0200 |
parents | b55181348b50 |
children | 27af701d5cf8 |
files | ChangeLog lib/sys_socket.in.h |
diffstat | 2 files changed, 28 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Apr 05 18:18:11 2010 +0200 +++ b/ChangeLog Mon Apr 05 18:34:08 2010 +0200 @@ -1,3 +1,10 @@ +2010-04-05 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> fseeko: Fix C++ test error on mingw.
--- a/lib/sys_socket.in.h Mon Apr 05 18:18:11 2010 +0200 +++ b/lib/sys_socket.in.h Mon Apr 05 18:34:08 2010 +0200 @@ -183,13 +183,23 @@ /* 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 <unistd.h>"); +# 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 <unistd.h>"); +# endif #endif #if @GNULIB_SOCKET@ @@ -571,8 +581,13 @@ #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 <sys/select.h>"); +# endif #endif #if @GNULIB_ACCEPT4@