From 616a1dadbd350571bd4ea787c4df95466d089875 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 12 Aug 2024 17:15:10 +0200 Subject: [PATCH] errno tests: Avoid test failure on Haiku. * doc/posix-headers/errno.texi: Mention the Haiku problem. * tests/test-errno.c: On Haiku, don't check that the error numbers are positive. --- ChangeLog | 7 +++++++ doc/posix-headers/errno.texi | 3 +++ tests/test-errno.c | 9 +++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4dda29205..63b19e0480 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-08-12 Bruno Haible + + errno tests: Avoid test failure on Haiku. + * doc/posix-headers/errno.texi: Mention the Haiku problem. + * tests/test-errno.c: On Haiku, don't check that the error numbers are + positive. + 2024-08-12 Bruno Haible errno: Ensure ESOCKTNOSUPPORT gets defined. diff --git a/doc/posix-headers/errno.texi b/doc/posix-headers/errno.texi index 4495fbfaee..3b8b22dabb 100644 --- a/doc/posix-headers/errno.texi +++ b/doc/posix-headers/errno.texi @@ -64,4 +64,7 @@ AIX 7.3. Portability problems not fixed by Gnulib: @itemize +@item +All error numbers are negative on some platforms: +Haiku. @end itemize diff --git a/tests/test-errno.c b/tests/test-errno.c index acd07ab95b..b54dc705dc 100644 --- a/tests/test-errno.c +++ b/tests/test-errno.c @@ -107,9 +107,14 @@ /* end of CHECK_POSIX_ERRNOS */ /* Verify that the POSIX mandated errno values can be used as integer - constant expressions and are all positive. */ -#define POSITIVE_INTEGER_CONSTANT_EXPRESSION(e) static_assert (0 < (e) << 0); + constant expressions and are all positive (except on Haiku). */ +#if defined __HAIKU__ +# define NONZERO_INTEGER_CONSTANT_EXPRESSION(e) static_assert (0 != (e) << 0); +CHECK_POSIX_ERRNOS (NONZERO_INTEGER_CONSTANT_EXPRESSION) +#else +# define POSITIVE_INTEGER_CONSTANT_EXPRESSION(e) static_assert (0 < (e) << 0); CHECK_POSIX_ERRNOS (POSITIVE_INTEGER_CONSTANT_EXPRESSION) +#endif /* Verify that errno values can all be used in #if. */ #define USABLE_IN_IF(e) ^ e -- 2.39.5