# HG changeset patch # User Bruno Haible # Date 1268008405 -3600 # Node ID e105c6e52c5de60d510f185a3a63b70d0faf2e6e # Parent 2c1c5f9d6a39701bc03f59304b1f474c2a1c0153 sys_select: Avoid #define replacements in C++ mode. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-03-07 Bruno Haible + sys_select: Avoid #define replacements in C++ mode. + * lib/sys_select.in.h: Include c++defs.h. Enable the function + definitions also when the system has a . + (select): In C++, define a namespaced alias symbol. + * modules/sys_select (Depends-on): Add c++defs. + (Makefile.am): Update sys/select.h rule. + sys_ioctl: Avoid #define replacements in C++ mode. * lib/sys_ioctl.in.h: Include c++defs.h. (ioctl): In C++, define a namespaced alias symbol. diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -64,39 +64,41 @@ #define _GL_SYS_SELECT_H #if !@HAVE_SYS_SELECT_H@ || @REPLACE_SELECT@ +/* A platform that lacks . */ +# include +#endif -/* A platform that lacks . */ - -# include +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ -# ifdef __cplusplus -extern "C" { -# endif -# if @GNULIB_SELECT@ -# if @HAVE_WINSOCK2_H@ || @REPLACE_SELECT@ +#if @GNULIB_SELECT@ +# if @HAVE_WINSOCK2_H@ || @REPLACE_SELECT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select rpl_select -extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); # endif -# elif @HAVE_WINSOCK2_H@ -# undef select -# define select select_used_without_requesting_gnulib_module_select -# elif defined GNULIB_POSIXCHECK -# undef select -# if HAVE_RAW_DECL_SELECT +_GL_FUNCDECL_RPL (select, int, + (int, fd_set *, fd_set *, fd_set *, struct timeval *)); +_GL_CXXALIAS_RPL (select, int, + (int, fd_set *, fd_set *, fd_set *, struct timeval *)); +# else +_GL_CXXALIAS_SYS (select, int, + (int, fd_set *, fd_set *, fd_set *, struct timeval *)); +# endif +_GL_CXXALIASWARN (select); +#elif @HAVE_WINSOCK2_H@ +# undef select +# define select select_used_without_requesting_gnulib_module_select +#elif defined GNULIB_POSIXCHECK +# undef select +# if HAVE_RAW_DECL_SELECT _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " "use gnulib module select for portability"); -# endif # endif +#endif -# ifdef __cplusplus -} -# endif - -#endif #endif /* _GL_SYS_SELECT_H */ #endif /* _GL_SYS_SELECT_H */ diff --git a/modules/sys_select b/modules/sys_select --- a/modules/sys_select +++ b/modules/sys_select @@ -7,6 +7,7 @@ Depends-on: include_next +c++defs sys_socket sys_time warn-on-use @@ -20,7 +21,7 @@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/select.h: sys_select.in.h $(WARN_ON_USE_H) +sys/select.h: sys_select.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -31,6 +32,7 @@ -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_select.in.h; \ } > $@-t && \