Mercurial > hg > octave-lyh > gnulib-hg
changeset 12932:fecbba7601e9
glob: Avoid #define replacements in C++ mode.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 08 Mar 2010 00:54:54 +0100 |
parents | 82b0c98fe7aa |
children | c6724931d704 |
files | ChangeLog lib/glob.in.h modules/glob |
diffstat | 3 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-03-07 Bruno Haible <bruno@clisp.org> + glob: Avoid #define replacements in C++ mode. + * lib/glob.in.h: Include c++defs.h, warn-on-use.h. + (_gl_glob_errfunc_fn): New type. + (glob, globfree, glob_pattern_p): In C++, define a namespaced alias + symbol. + * modules/glob (Depends-on): Add c++defs, warn-on-use. + (Makefile.am): Update glob.h rule. + fcntl-h: Avoid #define replacements in C++ mode. * lib/fcntl.in.h: Include c++defs.h. (fcntl, open, openat): In C++, define a namespaced alias symbol.
--- a/lib/glob.in.h +++ b/lib/glob.in.h @@ -45,8 +45,12 @@ # define __THROW #endif +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + /* The definition of _GL_ARG_NONNULL is copied here. */ +/* The definition of _GL_WARN_ON_USE is copied here. */ + #ifndef __size_t # define __size_t size_t #endif @@ -64,4 +68,24 @@ /* Now the standard GNU C Library header should work. */ #include "glob-libc.h" +__BEGIN_DECLS +typedef int (*_gl_glob_errfunc_fn) (const char *, int); +__END_DECLS + +#if defined __cplusplus && defined GNULIB_NAMESPACE +# undef glob +# undef globfree +# undef glob_pattern_p +_GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags, + _gl_glob_errfunc_fn __errfunc, + glob_t *_Restrict_ __pglob)); +_GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob)); +_GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote)); +# if 0 /* The C function name is rpl_glob, not glob. */ +_GL_CXXALIASWARN (glob); +_GL_CXXALIASWARN (globfree); +_GL_CXXALIASWARN (glob_pattern_p); +# endif +#endif + #endif /* _GL_GLOB_H */
--- a/modules/glob +++ b/modules/glob @@ -11,6 +11,7 @@ Depends-on: alloca arg-nonnull +c++defs d-type dirfd extensions @@ -22,6 +23,7 @@ strdup sys_stat unistd +warn-on-use malloc-posix configure.ac: @@ -32,11 +34,13 @@ # We need the following in order to create <glob.h> when the system # doesn't have one that works with the given compiler. -glob.h: glob.in.h $(ARG_NONNULL_H) +glob.h: glob.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/glob.in.h; \ } > $@-t && \ mv -f $@-t $@