On OpenBSD 6.5, I see a test failure of 'test-stdio'.

The _PRINTF_NAN_LEN_MAX check fails because the printed representation
of NaN, here, is "-nan"; however, gnulib's stdio.h had defined
_PRINTF_NAN_LEN_MAX to 3.

This patch fixes the value.


2023-04-07  Bruno Haible  <br...@clisp.org>

        stdio: Fix the value of _PRINTF_NAN_LEN_MAX on OpenBSD.
        * lib/stdio.in.h (_PRINTF_NAN_LEN_MAX): Define to 4 on OpenBSD.

diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 69242b6c36..f318014978 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -209,12 +209,11 @@
 #ifndef _PRINTF_NAN_LEN_MAX
 # if defined __FreeBSD__ || defined __DragonFly__ \
      || defined __NetBSD__ \
-     || defined __OpenBSD__ \
      || (defined __APPLE__ && defined __MACH__)
 /* On BSD systems, a NaN value prints as just "nan", without a sign.  */
 #  define _PRINTF_NAN_LEN_MAX 3
-# elif (__GLIBC__ >= 2) || MUSL_LIBC || defined __sun || defined __CYGWIN__
-/* glibc, musl libc, Solaris libc, and Cygwin produce "[-]nan".  */
+# elif (__GLIBC__ >= 2) || MUSL_LIBC || defined __OpenBSD__ || defined __sun 
|| defined __CYGWIN__
+/* glibc, musl libc, OpenBSD, Solaris libc, and Cygwin produce "[-]nan".  */
 #  define _PRINTF_NAN_LEN_MAX 4
 # elif defined _AIX
 /* AIX produces "[-]NaNQ".  */




Reply via email to