2025-01-17 Bruno Haible <bruno@clisp.org>
+ sys_stat-h: Ensure blksize_t and blkcnt_t are defined.
+ * tests/test-sys_stat-h.c: Check that blksize_t and blkcnt_t are
+ defined. Include intprops.h. Check the signedness of various types.
+ * modules/sys_stat-h-tests (Depends-on): Add intprops.
+ * doc/posix-headers/sys_stat.texi: Mention the issues with blksize_t and
+ blkcnt_t.
+
sys_types-h: Ensure blksize_t and blkcnt_t are defined.
* lib/sys_types.in.h (blksize_t, blkcnt_t): New definitions.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set HAVE_BLKSIZE_T and
The type @code{mode_t} is not defined on some platforms:
MSVC 14.
@item
+The type @code{blksize_t} is not defined on some platforms:
+FreeBSD 5.5, OpenBSD 5.6, HP-UX 11.23, IRIX 6.5, mingw, MSVC 14.
+@item
+The type @code{blkcnt_t} is not defined on some platforms:
+FreeBSD 5.5, OpenBSD 5.6, mingw, MSVC 14.
+@item
Some macros, such as @code{S_IFMT} or @code{S_IFIFO}, are missing on some
platforms.
@item
Portability problems not fixed by Gnulib:
@itemize
@item
+On some platforms the types @code{blksize_t} and @code{blkcnt_t} are unsigned:
+Android.
+@item
The macro @code{S_IFBLK} is missing on some platforms:
MSVC 14.
@item
Depends-on:
assert-h
+intprops
sys_stat-h-c++-tests
configure.ac:
nlink_t t1;
off_t t2;
mode_t t3;
+blksize_t t4;
+blkcnt_t t5;
struct timespec st;
+#include "intprops.h"
+
+/* POSIX requires that off_t is a signed integer type. */
+static_assert (TYPE_SIGNED (off_t));
+
+/* POSIX requires that blksize_t is a signed integer type. */
+#if !defined __ANDROID__
+static_assert (TYPE_SIGNED (blksize_t));
+#endif
+
+/* POSIX requires that blkcnt_t is a signed integer type. */
+#if !defined __ANDROID__
+static_assert (TYPE_SIGNED (blkcnt_t));
+#endif
+
int
main (void)
{