diff options
Diffstat (limited to 'lib/dirent.in.h')
-rw-r--r-- | lib/dirent.in.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 19c1014cf5a..425550ab3ab 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -29,6 +29,12 @@ #ifndef _@GUARD_PREFIX@_DIRENT_H #define _@GUARD_PREFIX@_DIRENT_H +/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, + _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Get ino_t. Needed on some systems, including glibc 2.8. */ #include <sys/types.h> @@ -50,11 +56,24 @@ struct dirent # define DT_LNK 10 /* symbolic link */ # define DT_SOCK 12 /* socket */ # define DT_WHT 14 /* whiteout */ -typedef struct gl_directory DIR; # define GNULIB_defined_struct_dirent 1 # endif #endif +#if !@DIR_HAS_FD_MEMBER@ +# if !GNULIB_defined_DIR +/* struct gl_directory is a type with a field 'int fd_to_close'. + It is needed for implementing fdopendir(). */ +struct gl_directory; +# if @HAVE_DIRENT_H@ +# define DIR struct gl_directory +# else +typedef struct gl_directory DIR; +# endif +# define GNULIB_defined_DIR 1 +# endif +#endif + /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers that can be freed by passing them as the Ith argument to the function F. */ @@ -143,7 +162,7 @@ _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); # endif _GL_CXXALIASWARN (opendir); #else -# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir +# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR && __GNUC__ >= 11 && !defined opendir /* For -Wmismatched-dealloc: Associate opendir with closedir or rpl_closedir. */ _GL_FUNCDECL_SYS (opendir, DIR *, @@ -161,10 +180,19 @@ _GL_WARN_ON_USE (opendir, "opendir is not portable - " #endif #if @GNULIB_READDIR@ -# if !@HAVE_READDIR@ +# if @REPLACE_READDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef readdir +# define readdir rpl_readdir +# endif +_GL_FUNCDECL_RPL (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (readdir, struct dirent *, (DIR *dirp)); +# else +# if !@HAVE_READDIR@ _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); +# endif _GL_CXXALIASWARN (readdir); #elif defined GNULIB_POSIXCHECK # undef readdir @@ -175,10 +203,19 @@ _GL_WARN_ON_USE (readdir, "readdir is not portable - " #endif #if @GNULIB_REWINDDIR@ -# if !@HAVE_REWINDDIR@ +# if @REPLACE_REWINDDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rewinddir +# define rewinddir rpl_rewinddir +# endif +_GL_FUNCDECL_RPL (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (rewinddir, void, (DIR *dirp)); +# else +# if !@HAVE_REWINDDIR@ _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); -# endif +# endif _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); +# endif _GL_CXXALIASWARN (rewinddir); #elif defined GNULIB_POSIXCHECK # undef rewinddir |