On QNX using the following testdir:
$ gnulib-tool --create-testdir --dir testdir1 sys_types-h
I see the following build error:
gcc -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1
-DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wno-error
-Wno-error -I/usr/include -D_QNX_SOURCE --sysroot=/ -MT test-sys_types-h.o -MD
-MP -MF .deps/test-sys_types-h.Tpo -c -o test-sys_types-h.o test-sys_types-h.c
In file included from test-sys_types-h.c:19:
../config.h:1543:25: error: static assertion failed
1543 | #define static_assert _Static_assert
| ^~~~~~~~~~~~~~
test-sys_types-h.c:52:1: note: in expansion of macro 'static_assert'
52 | static_assert (TYPE_SIGNED (blksize_t));
| ^~~~~~~~~~~~~
../config.h:1543:25: error: static assertion failed
1543 | #define static_assert _Static_assert
| ^~~~~~~~~~~~~~
test-sys_types-h.c:57:1: note: in expansion of macro 'static_assert'
57 | static_assert (TYPE_SIGNED (blkcnt_t));
| ^~~~~~~~~~~~~
make[4]: *** [Makefile:1462: test-sys_types-h.o] Error 1
This is because the system defines them with the incorrect signedness:
$ gcc -E -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1
-DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wno-error
-Wno-error -I/usr/include -D_QNX_SOURCE --sysroot=/ test-sys_types-h.c | grep
-E 'typedef.* blk(cnt|size)_t'
typedef _Uint64t blkcnt_t;
typedef _Uint32t blksize_t;
Like the other platforms with this issue, it is not worth replacing the
type. I pushed the attached patch ignoring the test on QNX and updating
the documentation.
Collin
>From 86511f6a27c8e95398d1a6e018eb846e36a12b9c Mon Sep 17 00:00:00 2001
Message-ID: <86511f6a27c8e95398d1a6e018eb846e36a12b9c.1767230682.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Wed, 31 Dec 2025 17:21:18 -0800
Subject: [PATCH] sys_types-h tests: Fix a static_assert failure on QNX.
* tests/test-sys_types-h.c [__QNX__]: Don't check that blksize_t and
blkcnt_t are signed. Add some parentheses for readability.
* doc/posix-headers/sys_types.texi: Mention that these types are
unsigned on this platform.
---
ChangeLog | 8 ++++++++
doc/posix-headers/sys_types.texi | 2 +-
tests/test-sys_types-h.c | 7 ++++---
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a3ae5b9a4f..f3fa3180d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-12-31 Collin Funk <[email protected]>
+
+ sys_types-h tests: Fix a static_assert failure on QNX.
+ * tests/test-sys_types-h.c [__QNX__]: Don't check that blksize_t and
+ blkcnt_t are signed. Add some parentheses for readability.
+ * doc/posix-headers/sys_types.texi: Mention that these types are
+ unsigned on this platform.
+
2025-12-26 Bruno Haible <[email protected]>
setlocale: Update regarding ISO 3166.
diff --git a/doc/posix-headers/sys_types.texi b/doc/posix-headers/sys_types.texi
index a39eef8d10..345e98ca88 100644
--- a/doc/posix-headers/sys_types.texi
+++ b/doc/posix-headers/sys_types.texi
@@ -45,7 +45,7 @@ @node sys/types.h
@item
On some platforms the types @code{blksize_t} and @code{blkcnt_t} are unsigned:
@c https://sourceware.org/PR33355
-Android, glibc/alpha.
+QNX, Android, glibc/alpha.
@item
On some platforms the types @code{blksize_t} and @code{suseconds_t}
are signed integer types that are wider than @code{long}:
diff --git a/tests/test-sys_types-h.c b/tests/test-sys_types-h.c
index b3d6abeca0..b11f10ac7e 100644
--- a/tests/test-sys_types-h.c
+++ b/tests/test-sys_types-h.c
@@ -46,14 +46,15 @@ static_assert (TYPE_SIGNED (off_t));
static_assert (TYPE_SIGNED (off64_t));
/* POSIX requires that blksize_t is a signed integer type. */
-#if !(defined __ANDROID__ \
+#if !(defined __ANDROID__ || defined __QNX__ \
|| (defined __FreeBSD_kernel__ && !defined __FreeBSD__) \
- || defined __GLIBC__ && defined __alpha)
+ || (defined __GLIBC__ && defined __alpha))
static_assert (TYPE_SIGNED (blksize_t));
#endif
/* POSIX requires that blkcnt_t is a signed integer type. */
-#if !(defined __ANDROID__ || defined __GLIBC__ && defined __alpha)
+#if !(defined __ANDROID__ || defined __QNX__ \
+ || (defined __GLIBC__ && defined __alpha))
static_assert (TYPE_SIGNED (blkcnt_t));
#endif
--
2.52.0