diff options
Diffstat (limited to 'gnulib-m4/printf.m4')
-rw-r--r-- | gnulib-m4/printf.m4 | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/gnulib-m4/printf.m4 b/gnulib-m4/printf.m4 index 6f917778..a6daa1a6 100644 --- a/gnulib-m4/printf.m4 +++ b/gnulib-m4/printf.m4 @@ -1,4 +1,5 @@ -# printf.m4 serial 90 +# printf.m4 +# serial 95 dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -615,6 +616,7 @@ static double zero = 0.0; int main () { int result = 0; + /* This fails on FreeBSD 5.2.1, Solaris 11.4. */ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 @@ -626,27 +628,29 @@ int main () && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 13.0 bug: it doesn't round. */ + result |= 1; + /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug: + it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ + result |= 2; + /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3, + Solaris 11.4 bug: it doesn't round. */ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x2p+0 33") != 0 && strcmp (buf, "0x3p-1 33") != 0 && strcmp (buf, "0x6p-2 33") != 0 && strcmp (buf, "0xcp-3 33") != 0)) result |= 4; - /* This catches a FreeBSD 6.1 bug. See + /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -654,7 +658,8 @@ int main () && strcmp (buf, "0x8.0p-2") != 0)) result |= 16; /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ + glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908> + and a FreeBSD 6.4, NetBSD 10.0 bug. */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -892,9 +897,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], [AC_LANG_SOURCE([[ #include <signal.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> +#if defined _WIN32 && !defined __CYGWIN__ +# include <stdlib.h> +#else +# include <unistd.h> +#endif #ifdef _MSC_VER +#include <crtdbg.h> #include <inttypes.h> /* See page about "Parameter Validation" on msdn.microsoft.com. <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> @@ -921,6 +931,9 @@ int main () int count = -1; #ifdef _MSC_VER _set_invalid_parameter_handler (invalid_parameter_handler); + /* Also avoid an Abort/Retry/Ignore dialog in debug builds. + <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode> */ + _CrtSetReportMode (_CRT_ASSERT, 0); #endif signal (SIGABRT, abort_handler); /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) @@ -1708,6 +1721,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], #include <signal.h> #include <stdio.h> #include <string.h> +#if defined _WIN32 && !defined __CYGWIN__ +# include <stdlib.h> +#else +# include <unistd.h> +#endif #if HAVE_SNPRINTF # define my_snprintf snprintf #else @@ -2039,7 +2057,7 @@ static wchar_t buf[100]; int main () { int result = 0; - /* This catches a glibc 2.15 and Haiku 2022 bug. */ + /* This catches a glibc 2.15, Haiku 2022, NetBSD 10.0 bug. */ if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), L"%La %d", 3.1416015625L, 33, 44, 55) < 0 || (wcscmp (buf, L"0x1.922p+1 33") != 0 @@ -2069,6 +2087,8 @@ int main () *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; # Guess yes on Android. linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; + # Guess no on NetBSD. + netbsd*) gl_cv_func_swprintf_directive_la="guessing no";; # Guess no on native Windows. mingw* | windows*) gl_cv_func_swprintf_directive_la="guessing no";; # If we don't know, obey --enable-cross-guesses. |