changeset 15416:10b35faca629

Rename module 'c++defs' to 'snippet/c++defs'. * modules/snippet/c++defs: Renamed from modules/c++defs. (Files, Makefile.am): Update. * build-aux/snippet/c++defs.h: Renamed from build-aux/c++defs.h. * modules/arpa_inet (Depends-on): Update. * modules/ctype (Depends-on): Update. * modules/dirent (Depends-on): Update. * modules/fcntl-h (Depends-on): Update. * modules/glob (Depends-on): Update. * modules/iconv-h (Depends-on): Update. * modules/langinfo (Depends-on): Update. * modules/locale (Depends-on): Update. * modules/math (Depends-on): Update. * modules/netdb (Depends-on): Update. * modules/poll-h (Depends-on): Update. * modules/pty (Depends-on): Update. * modules/search (Depends-on): Update. * modules/signal (Depends-on): Update. * modules/spawn (Depends-on): Update. * modules/stdio (Depends-on): Update. * modules/stdlib (Depends-on): Update. * modules/string (Depends-on): Update. * modules/strings (Depends-on): Update. * modules/sys_ioctl (Depends-on): Update. * modules/sys_select (Depends-on): Update. * modules/sys_socket (Depends-on): Update. * modules/sys_stat (Depends-on): Update. * modules/sys_time (Depends-on): Update. * modules/sys_wait (Depends-on): Update. * modules/termios (Depends-on): Update. * modules/time (Depends-on): Update. * modules/unistd (Depends-on): Update. * modules/wchar (Depends-on): Update. * modules/wctype-h (Depends-on): Update.
author Bruno Haible <bruno@clisp.org>
date Tue, 12 Jul 2011 11:39:50 +0200
parents 768296dab89a
children 3c3c5ba60033
files ChangeLog build-aux/c++defs.h build-aux/snippet/c++defs.h modules/arpa_inet modules/c++defs modules/ctype modules/dirent modules/fcntl-h modules/glob modules/iconv-h modules/langinfo modules/locale modules/math modules/netdb modules/poll-h modules/pty modules/search modules/signal modules/snippet/c++defs modules/spawn modules/stdio modules/stdlib modules/string modules/strings modules/sys_ioctl modules/sys_select modules/sys_socket modules/sys_stat modules/sys_time modules/sys_wait modules/termios modules/time modules/unistd modules/wchar modules/wctype-h
diffstat 35 files changed, 375 insertions(+), 340 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,40 @@
 2011-07-12  Bruno Haible  <bruno@clisp.org>
 
+	Rename module 'c++defs' to 'snippet/c++defs'.
+	* modules/snippet/c++defs: Renamed from modules/c++defs.
+	(Files, Makefile.am): Update.
+	* build-aux/snippet/c++defs.h: Renamed from build-aux/c++defs.h.
+	* modules/arpa_inet (Depends-on): Update.
+	* modules/ctype (Depends-on): Update.
+	* modules/dirent (Depends-on): Update.
+	* modules/fcntl-h (Depends-on): Update.
+	* modules/glob (Depends-on): Update.
+	* modules/iconv-h (Depends-on): Update.
+	* modules/langinfo (Depends-on): Update.
+	* modules/locale (Depends-on): Update.
+	* modules/math (Depends-on): Update.
+	* modules/netdb (Depends-on): Update.
+	* modules/poll-h (Depends-on): Update.
+	* modules/pty (Depends-on): Update.
+	* modules/search (Depends-on): Update.
+	* modules/signal (Depends-on): Update.
+	* modules/spawn (Depends-on): Update.
+	* modules/stdio (Depends-on): Update.
+	* modules/stdlib (Depends-on): Update.
+	* modules/string (Depends-on): Update.
+	* modules/strings (Depends-on): Update.
+	* modules/sys_ioctl (Depends-on): Update.
+	* modules/sys_select (Depends-on): Update.
+	* modules/sys_socket (Depends-on): Update.
+	* modules/sys_stat (Depends-on): Update.
+	* modules/sys_time (Depends-on): Update.
+	* modules/sys_wait (Depends-on): Update.
+	* modules/termios (Depends-on): Update.
+	* modules/time (Depends-on): Update.
+	* modules/unistd (Depends-on): Update.
+	* modules/wchar (Depends-on): Update.
+	* modules/wctype-h (Depends-on): Update.
+
 	Rename module 'arg-nonnull' to 'snippet/arg-nonnull'.
 	* modules/snippet/arg-nonnull: Renamed from modules/arg-nonnull.
 	(Files, Makefile.am): Update.
deleted file mode 100644
--- a/build-aux/c++defs.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/* C++ compatible function declaration macros.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _GL_CXXDEFS_H
-#define _GL_CXXDEFS_H
-
-/* The three most frequent use cases of these macros are:
-
-   * For providing a substitute for a function that is missing on some
-     platforms, but is declared and works fine on the platforms on which
-     it exists:
-
-       #if @GNULIB_FOO@
-       # if !@HAVE_FOO@
-       _GL_FUNCDECL_SYS (foo, ...);
-       # endif
-       _GL_CXXALIAS_SYS (foo, ...);
-       _GL_CXXALIASWARN (foo);
-       #elif defined GNULIB_POSIXCHECK
-       ...
-       #endif
-
-   * For providing a replacement for a function that exists on all platforms,
-     but is broken/insufficient and needs to be replaced on some platforms:
-
-       #if @GNULIB_FOO@
-       # if @REPLACE_FOO@
-       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-       #   undef foo
-       #   define foo rpl_foo
-       #  endif
-       _GL_FUNCDECL_RPL (foo, ...);
-       _GL_CXXALIAS_RPL (foo, ...);
-       # else
-       _GL_CXXALIAS_SYS (foo, ...);
-       # endif
-       _GL_CXXALIASWARN (foo);
-       #elif defined GNULIB_POSIXCHECK
-       ...
-       #endif
-
-   * For providing a replacement for a function that exists on some platforms
-     but is broken/insufficient and needs to be replaced on some of them and
-     is additionally either missing or undeclared on some other platforms:
-
-       #if @GNULIB_FOO@
-       # if @REPLACE_FOO@
-       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-       #   undef foo
-       #   define foo rpl_foo
-       #  endif
-       _GL_FUNCDECL_RPL (foo, ...);
-       _GL_CXXALIAS_RPL (foo, ...);
-       # else
-       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
-       _GL_FUNCDECL_SYS (foo, ...);
-       #  endif
-       _GL_CXXALIAS_SYS (foo, ...);
-       # endif
-       _GL_CXXALIASWARN (foo);
-       #elif defined GNULIB_POSIXCHECK
-       ...
-       #endif
-*/
-
-/* _GL_EXTERN_C declaration;
-   performs the declaration with C linkage.  */
-#if defined __cplusplus
-# define _GL_EXTERN_C extern "C"
-#else
-# define _GL_EXTERN_C extern
-#endif
-
-/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
-   declares a replacement function, named rpl_func, with the given prototype,
-   consisting of return type, parameters, and attributes.
-   Example:
-     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
-                                  _GL_ARG_NONNULL ((1)));
- */
-#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
-  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
-#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
-  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
-
-/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
-   declares the system function, named func, with the given prototype,
-   consisting of return type, parameters, and attributes.
-   Example:
-     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
-                                  _GL_ARG_NONNULL ((1)));
- */
-#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
-  _GL_EXTERN_C rettype func parameters_and_attributes
-
-/* _GL_CXXALIAS_RPL (func, rettype, parameters);
-   declares a C++ alias called GNULIB_NAMESPACE::func
-   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
-   Example:
-     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
- */
-#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
-  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
-    namespace GNULIB_NAMESPACE                                \
-    {                                                         \
-      rettype (*const func) parameters = ::rpl_func;          \
-    }                                                         \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#else
-# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
-   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
-   except that the C function rpl_func may have a slightly different
-   declaration.  A cast is used to silence the "invalid conversion" error
-   that would otherwise occur.  */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
-    namespace GNULIB_NAMESPACE                                     \
-    {                                                              \
-      rettype (*const func) parameters =                           \
-        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
-    }                                                              \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#else
-# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIAS_SYS (func, rettype, parameters);
-   declares a C++ alias called GNULIB_NAMESPACE::func
-   that redirects to the system provided function func, if GNULIB_NAMESPACE
-   is defined.
-   Example:
-     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
- */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-  /* If we were to write
-       rettype (*const func) parameters = ::func;
-     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
-     better (remove an indirection through a 'static' pointer variable),
-     but then the _GL_CXXALIASWARN macro below would cause a warning not only
-     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
-# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
-    namespace GNULIB_NAMESPACE                     \
-    {                                              \
-      static rettype (*func) parameters = ::func;  \
-    }                                              \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#else
-# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
-   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
-   except that the C function func may have a slightly different declaration.
-   A cast is used to silence the "invalid conversion" error that would
-   otherwise occur.  */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
-    namespace GNULIB_NAMESPACE                          \
-    {                                                   \
-      static rettype (*func) parameters =               \
-        reinterpret_cast<rettype(*)parameters>(::func); \
-    }                                                   \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#else
-# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
-   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
-   except that the C function is picked among a set of overloaded functions,
-   namely the one with rettype2 and parameters2.  Two consecutive casts
-   are used to silence the "cannot find a match" and "invalid conversion"
-   errors that would otherwise occur.  */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-  /* The outer cast must be a reinterpret_cast.
-     The inner cast: When the function is defined as a set of overloaded
-     functions, it works as a static_cast<>, choosing the designated variant.
-     When the function is defined as a single variant, it works as a
-     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
-# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
-    namespace GNULIB_NAMESPACE                                                \
-    {                                                                         \
-      static rettype (*func) parameters =                                     \
-        reinterpret_cast<rettype(*)parameters>(                               \
-          (rettype2(*)parameters2)(::func));                                  \
-    }                                                                         \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#else
-# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIASWARN (func);
-   causes a warning to be emitted when ::func is used but not when
-   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
-   variants.  */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIASWARN(func) \
-   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
-# define _GL_CXXALIASWARN_1(func,namespace) \
-   _GL_CXXALIASWARN_2 (func, namespace)
-/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
-   we enable the warning only when not optimizing.  */
-# if !__OPTIMIZE__
-#  define _GL_CXXALIASWARN_2(func,namespace) \
-    _GL_WARN_ON_USE (func, \
-                     "The symbol ::" #func " refers to the system function. " \
-                     "Use " #namespace "::" #func " instead.")
-# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
-#  define _GL_CXXALIASWARN_2(func,namespace) \
-     extern __typeof__ (func) func
-# else
-#  define _GL_CXXALIASWARN_2(func,namespace) \
-     _GL_EXTERN_C int _gl_cxxalias_dummy
-# endif
-#else
-# define _GL_CXXALIASWARN(func) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
-   causes a warning to be emitted when the given overloaded variant of ::func
-   is used but not when GNULIB_NAMESPACE::func is used.  */
-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
-   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
-                        GNULIB_NAMESPACE)
-# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
-   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
-/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
-   we enable the warning only when not optimizing.  */
-# if !__OPTIMIZE__
-#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
-    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
-                         "The symbol ::" #func " refers to the system function. " \
-                         "Use " #namespace "::" #func " instead.")
-# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
-#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
-     extern __typeof__ (func) func
-# else
-#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
-     _GL_EXTERN_C int _gl_cxxalias_dummy
-# endif
-#else
-# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
-    _GL_EXTERN_C int _gl_cxxalias_dummy
-#endif
-
-#endif /* _GL_CXXDEFS_H */
new file mode 100644
--- /dev/null
+++ b/build-aux/snippet/c++defs.h
@@ -0,0 +1,271 @@
+/* C++ compatible function declaration macros.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_CXXDEFS_H
+#define _GL_CXXDEFS_H
+
+/* The three most frequent use cases of these macros are:
+
+   * For providing a substitute for a function that is missing on some
+     platforms, but is declared and works fine on the platforms on which
+     it exists:
+
+       #if @GNULIB_FOO@
+       # if !@HAVE_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       # endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on all platforms,
+     but is broken/insufficient and needs to be replaced on some platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on some platforms
+     but is broken/insufficient and needs to be replaced on some of them and
+     is additionally either missing or undeclared on some other platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       #  endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+*/
+
+/* _GL_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#if defined __cplusplus
+# define _GL_EXTERN_C extern "C"
+#else
+# define _GL_EXTERN_C extern
+#endif
+
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
+   declares a replacement function, named rpl_func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
+  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
+
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
+   declares the system function, named func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype func parameters_and_attributes
+
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      rettype (*const func) parameters = ::rpl_func;          \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
+   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
+   except that the C function rpl_func may have a slightly different
+   declaration.  A cast is used to silence the "invalid conversion" error
+   that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                     \
+    {                                                              \
+      rettype (*const func) parameters =                           \
+        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
+    }                                                              \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to the system provided function func, if GNULIB_NAMESPACE
+   is defined.
+   Example:
+     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+ */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* If we were to write
+       rettype (*const func) parameters = ::func;
+     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
+     better (remove an indirection through a 'static' pointer variable),
+     but then the _GL_CXXALIASWARN macro below would cause a warning not only
+     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                     \
+    {                                              \
+      static rettype (*func) parameters = ::func;  \
+    }                                              \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                          \
+    {                                                   \
+      static rettype (*func) parameters =               \
+        reinterpret_cast<rettype(*)parameters>(::func); \
+    }                                                   \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function is picked among a set of overloaded functions,
+   namely the one with rettype2 and parameters2.  Two consecutive casts
+   are used to silence the "cannot find a match" and "invalid conversion"
+   errors that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* The outer cast must be a reinterpret_cast.
+     The inner cast: When the function is defined as a set of overloaded
+     functions, it works as a static_cast<>, choosing the designated variant.
+     When the function is defined as a single variant, it works as a
+     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    namespace GNULIB_NAMESPACE                                                \
+    {                                                                         \
+      static rettype (*func) parameters =                                     \
+        reinterpret_cast<rettype(*)parameters>(                               \
+          (rettype2(*)parameters2)(::func));                                  \
+    }                                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN (func);
+   causes a warning to be emitted when ::func is used but not when
+   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
+   variants.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN(func) \
+   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN_1(func,namespace) \
+   _GL_CXXALIASWARN_2 (func, namespace)
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !__OPTIMIZE__
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+    _GL_WARN_ON_USE (func, \
+                     "The symbol ::" #func " refers to the system function. " \
+                     "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     extern __typeof__ (func) func
+# else
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN(func) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
+   causes a warning to be emitted when the given overloaded variant of ::func
+   is used but not when GNULIB_NAMESPACE::func is used.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
+                        GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
+   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !__OPTIMIZE__
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
+                         "The symbol ::" #func " refers to the system function. " \
+                         "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+     extern __typeof__ (func) func
+# else
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+#endif /* _GL_CXXDEFS_H */
--- a/modules/arpa_inet
+++ b/modules/arpa_inet
@@ -6,9 +6,9 @@
 m4/arpa_inet_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 sys_socket
 warn-on-use
 
deleted file mode 100644
--- a/modules/c++defs
+++ /dev/null
@@ -1,39 +0,0 @@
-Description:
-Function declaration macros with C++ support.
-
-Applicability:
-all
-
-Files:
-build-aux/c++defs.h
-
-Depends-on:
-
-configure.ac:
-
-Makefile.am:
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/build-aux/c++defs.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/_GL_CXXDEFS/,$$p' \
-	  < $(top_srcdir)/build-aux/c++defs.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-Include:
-
-License:
-LGPLv2+
-
-Maintainer:
-Bruno Haible
--- a/modules/ctype
+++ b/modules/ctype
@@ -7,7 +7,7 @@
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/dirent
+++ b/modules/dirent
@@ -7,9 +7,9 @@
 m4/unistd_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/fcntl-h
+++ b/modules/fcntl-h
@@ -7,10 +7,10 @@
 m4/fcntl-o.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 unistd
 warn-on-use
 
--- a/modules/glob
+++ b/modules/glob
@@ -9,9 +9,9 @@
 m4/glob.m4
 
 Depends-on:
-c++defs
 extensions
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 alloca          [test -n "$GLOB_H"]
 d-type          [test -n "$GLOB_H"]
--- a/modules/iconv-h
+++ b/modules/iconv-h
@@ -7,8 +7,8 @@
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/langinfo
+++ b/modules/langinfo
@@ -8,7 +8,7 @@
 Depends-on:
 extensions
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/locale
+++ b/modules/locale
@@ -6,10 +6,10 @@
 m4/locale_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
--- a/modules/math
+++ b/modules/math
@@ -6,9 +6,9 @@
 m4/math_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/netdb
+++ b/modules/netdb
@@ -6,9 +6,9 @@
 m4/netdb_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 sys_socket
 
--- a/modules/poll-h
+++ b/modules/poll-h
@@ -6,9 +6,9 @@
 m4/poll_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/pty
+++ b/modules/pty
@@ -6,8 +6,8 @@
 m4/pty_h.m4
 
 Depends-on:
-c++defs
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/search
+++ b/modules/search
@@ -6,9 +6,9 @@
 m4/search_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/signal
+++ b/modules/signal
@@ -6,9 +6,9 @@
 m4/signal_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 extensions
 
new file mode 100644
--- /dev/null
+++ b/modules/snippet/c++defs
@@ -0,0 +1,39 @@
+Description:
+Function declaration macros with C++ support.
+
+Applicability:
+all
+
+Files:
+build-aux/snippet/c++defs.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/_GL_CXXDEFS/,$$p' \
+	  < $(top_srcdir)/build-aux/snippet/c++defs.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/spawn
+++ b/modules/spawn
@@ -6,10 +6,10 @@
 m4/spawn_h.m4
 
 Depends-on:
-c++defs
 include_next
 sched
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/stdio
+++ b/modules/stdio
@@ -7,8 +7,8 @@
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -7,9 +7,9 @@
 
 Depends-on:
 _Noreturn
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 unistd
 warn-on-use
--- a/modules/string
+++ b/modules/string
@@ -6,10 +6,10 @@
 m4/string_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
--- a/modules/strings
+++ b/modules/strings
@@ -6,9 +6,9 @@
 m4/strings_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/sys_ioctl
+++ b/modules/sys_ioctl
@@ -7,7 +7,7 @@
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 unistd
 warn-on-use
 
--- a/modules/sys_select
+++ b/modules/sys_select
@@ -8,8 +8,8 @@
 
 Depends-on:
 include_next
-c++defs
 signal
+snippet/c++defs
 sys_time
 warn-on-use
 
--- a/modules/sys_socket
+++ b/modules/sys_socket
@@ -8,10 +8,10 @@
 
 Depends-on:
 alignof
-c++defs
 errno
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 socklen
 sys_uio
 warn-on-use
--- a/modules/sys_stat
+++ b/modules/sys_stat
@@ -7,9 +7,9 @@
 m4/unistd_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 time
 warn-on-use
 
--- a/modules/sys_time
+++ b/modules/sys_time
@@ -7,8 +7,8 @@
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/sys_wait
+++ b/modules/sys_wait
@@ -6,8 +6,8 @@
 m4/sys_wait_h.m4
 
 Depends-on:
-c++defs
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/termios
+++ b/modules/termios
@@ -7,7 +7,7 @@
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
--- a/modules/time
+++ b/modules/time
@@ -8,8 +8,8 @@
 Depends-on:
 extensions
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 stddef
 
--- a/modules/unistd
+++ b/modules/unistd
@@ -6,9 +6,9 @@
 lib/unistd.in.h
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
--- a/modules/wchar
+++ b/modules/wchar
@@ -7,9 +7,9 @@
 m4/wint_t.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
--- a/modules/wctype-h
+++ b/modules/wctype-h
@@ -8,7 +8,7 @@
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac: