]> Savannah Git Hosting - gnulib.git/commitdiff
sys_stat-h: Ensure blksize_t and blkcnt_t are defined.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Jan 2025 21:51:55 +0000 (22:51 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 17 Jan 2025 21:51:55 +0000 (22:51 +0100)
* 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.

ChangeLog
doc/posix-headers/sys_stat.texi
modules/sys_stat-h-tests
tests/test-sys_stat-h.c

index 8b77cac9ee9a0a5c2daf6ef901189a1fff1f4a22..f41d5c885f3f23afedece72b68a20eaef065ceb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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
index bc889e986fc303e8824cd31447a2ea3c1a182df9..764451255f2c5abc721fe5f6aac007cfed375623 100644 (file)
@@ -12,6 +12,12 @@ Portability problems fixed by Gnulib module @code{sys_stat-h}:
 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
@@ -54,6 +60,9 @@ Also, on platforms where @code{ino_t} is a 32-bit type,
 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
index a13ea11e45de45ca463acfbe81706cb9d2fa783f..aa853c5badf5c28038f07babb782d2a856a3901a 100644 (file)
@@ -3,6 +3,7 @@ tests/test-sys_stat-h.c
 
 Depends-on:
 assert-h
+intprops
 sys_stat-h-c++-tests
 
 configure.ac:
index f433935fb16039a9c87d497d267b7defda333867..510aa21ea3d173b293df5b6ead8ba0e9a03e055c 100644 (file)
@@ -328,9 +328,26 @@ invalid UTIME macros
 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)
 {