Rename module 'c++defs' to 'snippet/c++defs'.
authorBruno Haible <bruno@clisp.org>
Tue, 12 Jul 2011 09:39:50 +0000 (11:39 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 12 Jul 2011 09:39:50 +0000 (11:39 +0200)
* 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.

35 files changed:
ChangeLog
build-aux/c++defs.h [deleted file]
build-aux/snippet/c++defs.h [new file with mode: 0644]
modules/arpa_inet
modules/c++defs [deleted file]
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 [new file with mode: 0644]
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

index e3009770e44855568463606ad031ecff0a064f96..c5f54ae383173c4fd8c511ab03964643870e2981 100644 (file)
--- 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.
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h
deleted file mode 100644 (file)
index 67c3f65..0000000
+++ /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 */
diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h
new file mode 100644 (file)
index 0000000..67c3f65
--- /dev/null
@@ -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 */
index 0be145ef2c7742d0d217ef957ca171422c34fcdf..6fd3bd917c46dc623931471ad3d36cb93e28c3b2 100644 (file)
@@ -6,9 +6,9 @@ lib/arpa_inet.in.h
 m4/arpa_inet_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 sys_socket
 warn-on-use
 
diff --git a/modules/c++defs b/modules/c++defs
deleted file mode 100644 (file)
index 186584f..0000000
+++ /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
index 277c1e4a96cfb9d6c5da4aacdfd1b5cc577ef8cc..fbbc541b225307fc3cebbda57598448a4b47bf68 100644 (file)
@@ -7,7 +7,7 @@ m4/ctype.m4
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index 52969d71b19f974911c74d649ba4862bcf899134..e7e7b9b35310eca301b69916718fa84eb37272b8 100644 (file)
@@ -7,9 +7,9 @@ m4/dirent_h.m4
 m4/unistd_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index cb7f947ff31bf551e5cb9a0d31680b9d93bb27e3..d3531e99b6390212ada102f5c31ff5f515c067df 100644 (file)
@@ -7,10 +7,10 @@ m4/fcntl_h.m4
 m4/fcntl-o.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 unistd
 warn-on-use
 
index 02b02829a95486893a5890f4444c8e5ea20dadc8..2f67794edab4c2f7e3f060ca86acc296bc8c3ceb 100644 (file)
@@ -9,9 +9,9 @@ lib/glob.c
 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"]
index 8984d304e4baef48c5d6bb07ca21f117787cb0f0..7240784f0bd028dffb6131367c0a0eb1a8716b05 100644 (file)
@@ -7,8 +7,8 @@ m4/iconv_h.m4
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index f76bd657d0e96a77508e0c81cd79906ddb72a953..6b5a8725ab4785a5c38f627c9420d04a1ed3d397 100644 (file)
@@ -8,7 +8,7 @@ m4/langinfo_h.m4
 Depends-on:
 extensions
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index 70e5e286e5f01492791ce6177e16a8e5163c304c..0aa8925afa13c5ed2b63265b3f28e366984599c1 100644 (file)
@@ -6,10 +6,10 @@ lib/locale.in.h
 m4/locale_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
index b4ea6fbbae3fe75cb5e1d8f30246404413bb48a0..4f3f2289cbba5998fc585502947cb6acfa34065b 100644 (file)
@@ -6,9 +6,9 @@ lib/math.in.h
 m4/math_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index 5e3dee5668d55fb05462c7cf0c26363f0e1283a9..75cfd8b6c6ac67812673300cd5c6ca2799054dd1 100644 (file)
@@ -6,9 +6,9 @@ lib/netdb.in.h
 m4/netdb_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 sys_socket
 
index 8935ae15fff7fba25c4f5aa4fad90d9b4bae2206..ab21341d8e0a7d8eb4a6ef6cc836c062f521dab0 100644 (file)
@@ -6,9 +6,9 @@ lib/poll.in.h
 m4/poll_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index dcc7842c5b9a60864fd58fa6f9af556d67fdcf79..beaa1ccd896728f7dfa66a2de066858fed00634c 100644 (file)
@@ -6,8 +6,8 @@ lib/pty.in.h
 m4/pty_h.m4
 
 Depends-on:
-c++defs
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index e4e064efa70b6b837074e9fa3bc435d1ba6bbeb8..66cd19d0e3b73b0fc06c6e8b52cc999f01dadb68 100644 (file)
@@ -6,9 +6,9 @@ lib/search.in.h
 m4/search_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index d70302e9d85a09a4d3227e7953e45482be6e00e7..2e810ae09b7eb8d5316e1e0e85c2f48e3c159f8a 100644 (file)
@@ -6,9 +6,9 @@ lib/signal.in.h
 m4/signal_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 extensions
 
diff --git a/modules/snippet/c++defs b/modules/snippet/c++defs
new file mode 100644 (file)
index 0000000..e624bed
--- /dev/null
@@ -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
index 650d260d4c5180fee906724508d669a101cf10ef..12c28abacb744869c69d1fa61e3a7e0ec248e486 100644 (file)
@@ -6,10 +6,10 @@ lib/spawn.in.h
 m4/spawn_h.m4
 
 Depends-on:
-c++defs
 include_next
 sched
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index fdae894985a9387e44da8d1ccb8e1aeeafd552cb..75a3c989ace322bd940c37d96651f68b733a5152 100644 (file)
@@ -7,8 +7,8 @@ m4/stdio_h.m4
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
index c0497637f0257ce670130b5098c2f50efede516e..ae51e9fd474e4b16ce3efd055bebb34524462515 100644 (file)
@@ -7,9 +7,9 @@ m4/stdlib_h.m4
 
 Depends-on:
 _Noreturn
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 unistd
 warn-on-use
index f457ab13fe9f2686a21d748170afff35a0ac9eff..afa4f3ca29c9a7dcc0ce4a7a10727f30820749a3 100644 (file)
@@ -6,10 +6,10 @@ lib/string.in.h
 m4/string_h.m4
 
 Depends-on:
-c++defs
 extensions
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
index 3c4de9051f931192f63ee2bc2b5177313e025f73..ef1e13cb607233c66bda4b9f60772047bb60e7b3 100644 (file)
@@ -6,9 +6,9 @@ lib/strings.in.h
 m4/strings_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index be247f66a9315c4a488a4aff00bc9c9e63002b5a..4fa807ff5b9dd6fe07c558a5b5f8c00d9b9fb83b 100644 (file)
@@ -7,7 +7,7 @@ m4/sys_ioctl_h.m4
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 unistd
 warn-on-use
 
index 5af56ddda6c71c007280d29c3d35ea0fa9b006bb..3d579f9ef83db8ee470c11cf234a64011d57f3ce 100644 (file)
@@ -8,8 +8,8 @@ m4/sys_socket_h.m4
 
 Depends-on:
 include_next
-c++defs
 signal
+snippet/c++defs
 sys_time
 warn-on-use
 
index b78e782558ab9f8de43251f6e4acf009639253af..5bcde537388aacc5683344a4fe2468d18d691595 100644 (file)
@@ -8,10 +8,10 @@ m4/sockpfaf.m4
 
 Depends-on:
 alignof
-c++defs
 errno
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 socklen
 sys_uio
 warn-on-use
index baa531b68b61c29ef94e8b9ca540bf265b9cf4c9..3bb367bf38bcc2af3c4f791f90bf739fb599313e 100644 (file)
@@ -7,9 +7,9 @@ m4/sys_stat_h.m4
 m4/unistd_h.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 time
 warn-on-use
 
index ca5862d4e9db46745632e5c6b3941d325c81fd9a..1d271bc569142d2823eef5a6f0a812685b94e163 100644 (file)
@@ -7,8 +7,8 @@ m4/sys_time_h.m4
 
 Depends-on:
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index ad3d4407af6ff71f83cb6220ed11243efae42f7d..2159e55beeaf0aaba352e8354f6e744b1436a29b 100644 (file)
@@ -6,8 +6,8 @@ lib/sys_wait.in.h
 m4/sys_wait_h.m4
 
 Depends-on:
-c++defs
 include_next
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index f747e9234e090b3edd12baf0fa42322e3dee9f78..60e9b443361cae8e204f966acea30b2754eeae73 100644 (file)
@@ -7,7 +7,7 @@ m4/termios_h.m4
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac:
index 4af57fd118f9b03f84787ddff32b949972973105..34d749a7c0782016af90209304748f69d60345be 100644 (file)
@@ -8,8 +8,8 @@ m4/time_h.m4
 Depends-on:
 extensions
 include_next
-c++defs
 snippet/arg-nonnull
+snippet/c++defs
 warn-on-use
 stddef
 
index 48c7c047aaee46f94d9e00e832adce077c619c35..fa69a8b7b2f4b40d846d21cd9e98d16d8bf59a1c 100644 (file)
@@ -6,9 +6,9 @@ m4/unistd_h.m4
 lib/unistd.in.h
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
index 6efec9f45c88fad76f18f744794774d91dc25b6e..04ff3459dc2ff5ed7a429a484c6673999a6e38a7 100644 (file)
@@ -7,9 +7,9 @@ m4/wchar_h.m4
 m4/wint_t.m4
 
 Depends-on:
-c++defs
 include_next
 snippet/arg-nonnull
+snippet/c++defs
 stddef
 warn-on-use
 
index 20f773ec8d6d6515ebc073bd6d0ee57e6247cd19..08c66c6c6fdaaa0b624045b4aaba0446015ce195 100644 (file)
@@ -8,7 +8,7 @@ m4/wint_t.m4
 
 Depends-on:
 include_next
-c++defs
+snippet/c++defs
 warn-on-use
 
 configure.ac: