From: Bruno Haible Date: Tue, 12 Jul 2011 09:39:50 +0000 (+0200) Subject: Rename module 'c++defs' to 'snippet/c++defs'. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6045c2ba7c6a9fb040d41abd78765bfad437a08f;p=pspp 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. --- diff --git a/ChangeLog b/ChangeLog index e3009770e4..c5f54ae383 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,40 @@ 2011-07-12 Bruno Haible + 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 index 67c3f65eeb..0000000000 --- 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 . */ - -#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(::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(::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( \ - (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 , - 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 , - 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 index 0000000000..67c3f65eeb --- /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 . */ + +#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(::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(::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( \ + (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 , + 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 , + 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/modules/arpa_inet b/modules/arpa_inet index 0be145ef2c..6fd3bd917c 100644 --- a/modules/arpa_inet +++ b/modules/arpa_inet @@ -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 index 186584f31e..0000000000 --- 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 diff --git a/modules/ctype b/modules/ctype index 277c1e4a96..fbbc541b22 100644 --- a/modules/ctype +++ b/modules/ctype @@ -7,7 +7,7 @@ m4/ctype.m4 Depends-on: include_next -c++defs +snippet/c++defs warn-on-use configure.ac: diff --git a/modules/dirent b/modules/dirent index 52969d71b1..e7e7b9b353 100644 --- a/modules/dirent +++ b/modules/dirent @@ -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: diff --git a/modules/fcntl-h b/modules/fcntl-h index cb7f947ff3..d3531e99b6 100644 --- a/modules/fcntl-h +++ b/modules/fcntl-h @@ -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 diff --git a/modules/glob b/modules/glob index 02b02829a9..2f67794eda 100644 --- a/modules/glob +++ b/modules/glob @@ -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"] diff --git a/modules/iconv-h b/modules/iconv-h index 8984d304e4..7240784f0b 100644 --- a/modules/iconv-h +++ b/modules/iconv-h @@ -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: diff --git a/modules/langinfo b/modules/langinfo index f76bd657d0..6b5a8725ab 100644 --- a/modules/langinfo +++ b/modules/langinfo @@ -8,7 +8,7 @@ m4/langinfo_h.m4 Depends-on: extensions include_next -c++defs +snippet/c++defs warn-on-use configure.ac: diff --git a/modules/locale b/modules/locale index 70e5e286e5..0aa8925afa 100644 --- a/modules/locale +++ b/modules/locale @@ -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 diff --git a/modules/math b/modules/math index b4ea6fbbae..4f3f2289cb 100644 --- a/modules/math +++ b/modules/math @@ -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: diff --git a/modules/netdb b/modules/netdb index 5e3dee5668..75cfd8b6c6 100644 --- a/modules/netdb +++ b/modules/netdb @@ -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 diff --git a/modules/poll-h b/modules/poll-h index 8935ae15ff..ab21341d8e 100644 --- a/modules/poll-h +++ b/modules/poll-h @@ -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: diff --git a/modules/pty b/modules/pty index dcc7842c5b..beaa1ccd89 100644 --- a/modules/pty +++ b/modules/pty @@ -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: diff --git a/modules/search b/modules/search index e4e064efa7..66cd19d0e3 100644 --- a/modules/search +++ b/modules/search @@ -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: diff --git a/modules/signal b/modules/signal index d70302e9d8..2e810ae09b 100644 --- a/modules/signal +++ b/modules/signal @@ -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 index 0000000000..e624bed4d7 --- /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 diff --git a/modules/spawn b/modules/spawn index 650d260d4c..12c28abacb 100644 --- a/modules/spawn +++ b/modules/spawn @@ -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: diff --git a/modules/stdio b/modules/stdio index fdae894985..75a3c989ac 100644 --- a/modules/stdio +++ b/modules/stdio @@ -7,8 +7,8 @@ m4/stdio_h.m4 Depends-on: include_next -c++defs snippet/arg-nonnull +snippet/c++defs stddef warn-on-use diff --git a/modules/stdlib b/modules/stdlib index c0497637f0..ae51e9fd47 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -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 diff --git a/modules/string b/modules/string index f457ab13fe..afa4f3ca29 100644 --- a/modules/string +++ b/modules/string @@ -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 diff --git a/modules/strings b/modules/strings index 3c4de9051f..ef1e13cb60 100644 --- a/modules/strings +++ b/modules/strings @@ -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: diff --git a/modules/sys_ioctl b/modules/sys_ioctl index be247f66a9..4fa807ff5b 100644 --- a/modules/sys_ioctl +++ b/modules/sys_ioctl @@ -7,7 +7,7 @@ m4/sys_ioctl_h.m4 Depends-on: include_next -c++defs +snippet/c++defs unistd warn-on-use diff --git a/modules/sys_select b/modules/sys_select index 5af56ddda6..3d579f9ef8 100644 --- a/modules/sys_select +++ b/modules/sys_select @@ -8,8 +8,8 @@ m4/sys_socket_h.m4 Depends-on: include_next -c++defs signal +snippet/c++defs sys_time warn-on-use diff --git a/modules/sys_socket b/modules/sys_socket index b78e782558..5bcde53738 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -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 diff --git a/modules/sys_stat b/modules/sys_stat index baa531b68b..3bb367bf38 100644 --- a/modules/sys_stat +++ b/modules/sys_stat @@ -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 diff --git a/modules/sys_time b/modules/sys_time index ca5862d4e9..1d271bc569 100644 --- a/modules/sys_time +++ b/modules/sys_time @@ -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: diff --git a/modules/sys_wait b/modules/sys_wait index ad3d4407af..2159e55bee 100644 --- a/modules/sys_wait +++ b/modules/sys_wait @@ -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: diff --git a/modules/termios b/modules/termios index f747e9234e..60e9b44336 100644 --- a/modules/termios +++ b/modules/termios @@ -7,7 +7,7 @@ m4/termios_h.m4 Depends-on: include_next -c++defs +snippet/c++defs warn-on-use configure.ac: diff --git a/modules/time b/modules/time index 4af57fd118..34d749a7c0 100644 --- a/modules/time +++ b/modules/time @@ -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 diff --git a/modules/unistd b/modules/unistd index 48c7c047aa..fa69a8b7b2 100644 --- a/modules/unistd +++ b/modules/unistd @@ -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 diff --git a/modules/wchar b/modules/wchar index 6efec9f45c..04ff3459dc 100644 --- a/modules/wchar +++ b/modules/wchar @@ -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 diff --git a/modules/wctype-h b/modules/wctype-h index 20f773ec8d..08c66c6c6f 100644 --- a/modules/wctype-h +++ b/modules/wctype-h @@ -8,7 +8,7 @@ m4/wint_t.m4 Depends-on: include_next -c++defs +snippet/c++defs warn-on-use configure.ac: