summaryrefslogtreecommitdiff
path: root/lib/sys_stat.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sys_stat.in.h')
-rw-r--r--lib/sys_stat.in.h90
1 files changed, 50 insertions, 40 deletions
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index bf08f33536d..d2ecdb9da96 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -55,7 +55,8 @@
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
#define _@GUARD_PREFIX@_SYS_STAT_H
-/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
+/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
+ GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -65,7 +66,7 @@
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -122,9 +123,11 @@
# if @GNULIB_STAT@
# define stat rpl_stat
# else
- /* Provoke a clear link error if stat() is used as a function and
- module 'stat' is not in use. */
-# define stat stat_used_without_requesting_gnulib_module_stat
+# if !GNULIB_STAT
+ /* Provoke a clear link error if stat() is used as a function and
+ module 'stat' is not in use. */
+# define stat stat_used_without_requesting_gnulib_module_stat
+# endif
# endif
# if !GNULIB_defined_struct_stat
@@ -433,7 +436,7 @@ struct stat
# undef chmod
# define chmod rpl_chmod
# endif
-_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
+_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -478,15 +481,15 @@ _GL_CXXALIASWARN (chmod);
# define fchmodat rpl_fchmodat
# endif
_GL_FUNCDECL_RPL (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *file, mode_t mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag));
# else
# if !@HAVE_FCHMODAT@
_GL_FUNCDECL_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *file, mode_t mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag));
@@ -507,7 +510,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
# undef fstat
# define fstat rpl_fstat
# endif
-_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf),
+ _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
# else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
@@ -516,8 +520,10 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
_GL_CXXALIASWARN (fstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef fstat
-# define fstat fstat_used_without_requesting_gnulib_module_fstat
+# if !GNULIB_FSTAT
+# undef fstat
+# define fstat fstat_used_without_requesting_gnulib_module_fstat
+# endif
#elif @WINDOWS_64_BIT_ST_SIZE@
/* Above, we define stat to _stati64. */
# define fstat _fstati64
@@ -538,7 +544,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
# endif
_GL_FUNCDECL_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
- int flags)
+ int flags),
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
@@ -547,7 +553,7 @@ _GL_CXXALIAS_RPL (fstatat, int,
# if !@HAVE_FSTATAT@
_GL_FUNCDECL_SYS (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
- int flags)
+ int flags),
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (fstatat, int,
@@ -556,8 +562,10 @@ _GL_CXXALIAS_SYS (fstatat, int,
# endif
_GL_CXXALIASWARN (fstatat);
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef fstatat
-# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
+# if !GNULIB_FSTATAT
+# undef fstatat
+# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fstatat
# if HAVE_RAW_DECL_FSTATAT
@@ -600,7 +608,7 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
#if @GNULIB_GETUMASK@
# if !@HAVE_GETUMASK@
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
-_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW);
+_GL_FUNCDECL_SYS (getumask, mode_t, (void)) _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (getumask, mode_t, (void));
# endif
@@ -622,7 +630,7 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - "
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
denotes a symbolic link. */
# if !@HAVE_LCHMOD@ || defined __hpux
-_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
@@ -642,7 +650,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
# undef mkdir
# define mkdir rpl_mkdir
# endif
-_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -667,12 +675,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
# endif
_GL_CXXALIASWARN (mkdir);
-#elif defined GNULIB_POSIXCHECK
-# undef mkdir
-# if HAVE_RAW_DECL_MKDIR
-_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
- "use gnulib module mkdir for portability");
-# endif
#elif @GNULIB_MDA_MKDIR@
/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between
@@ -695,12 +697,18 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
# endif
_GL_CXXALIASWARN (mkdir);
+#elif defined GNULIB_POSIXCHECK
+# undef mkdir
+# if HAVE_RAW_DECL_MKDIR
+_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
+ "use gnulib module mkdir for portability");
+# endif
#endif
#if @GNULIB_MKDIRAT@
# if !@HAVE_MKDIRAT@
-_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
@@ -720,12 +728,12 @@ _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
# undef mkfifo
# define mkfifo rpl_mkfifo
# endif
-_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
# else
# if !@HAVE_MKFIFO@
-_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
@@ -746,12 +754,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
# undef mkfifoat
# define mkfifoat rpl_mkfifoat
# endif
-_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
# else
# if !@HAVE_MKFIFOAT@
-_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
@@ -774,12 +782,12 @@ _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
# undef mknod
# define mknod rpl_mknod
# endif
-_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
# else
# if !@HAVE_MKNOD@
-_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
@@ -802,14 +810,14 @@ _GL_WARN_ON_USE (mknod, "mknod is not portable - "
# define mknodat rpl_mknodat
# endif
_GL_FUNCDECL_RPL (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev)
+ (int fd, char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mknodat, int,
(int fd, char const *file, mode_t mode, dev_t dev));
# else
# if !@HAVE_MKNODAT@
_GL_FUNCDECL_SYS (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev)
+ (int fd, char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mknodat, int,
@@ -916,7 +924,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int,
# define lstat rpl_lstat
# endif
_GL_FUNCDECL_RPL (lstat, int,
- (const char *restrict name, struct stat *restrict buf)
+ (const char *restrict name, struct stat *restrict buf),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf));
@@ -928,8 +936,10 @@ _GL_CXXALIAS_SYS (lstat, int,
_GL_CXXALIASWARN (lstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef lstat
-# define lstat lstat_used_without_requesting_gnulib_module_lstat
+# if !GNULIB_LSTAT
+# undef lstat
+# define lstat lstat_used_without_requesting_gnulib_module_lstat
+# endif
#elif defined GNULIB_POSIXCHECK
# undef lstat
# if HAVE_RAW_DECL_LSTAT
@@ -968,14 +978,14 @@ _GL_CXXALIASWARN (umask);
# define utimensat rpl_utimensat
# endif
_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
+ struct timespec const times[2], int flag),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag));
# else
# if !@HAVE_UTIMENSAT@
_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
+ struct timespec const times[2], int flag),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,