These tests run without sigfpe_on_invalid(), therefore they won't crash.
* tests/test-vasnprintf-posix.c: Include snan.h.
(test_function): For each test case that uses NaNd or NaNl, add a test
case with SNaNd or SNaNl, respectively.
* tests/test-vasprintf-posix.c: Likewise.
* tests/test-snprintf-posix.h: Likewise.
* tests/test-sprintf-posix.h: Likewise.
* tests/test-vasnwprintf-posix.c: Likewise.
* modules/vasnprintf-posix-tests (Depends-on): Add snan.
* modules/vasprintf-posix-tests (Depends-on): Likewise.
* modules/vsnprintf-posix-tests (Depends-on): Likewise.
* modules/snprintf-posix-tests (Depends-on): Likewise.
* modules/vsprintf-posix-tests (Depends-on): Likewise.
* modules/sprintf-posix-tests (Depends-on): Likewise.
* modules/vasnwprintf-posix-tests (Depends-on): Likewise.
* modules/pipe-filter-gi-tests (Depends-on): Likewise.
* modules/pipe-filter-ii-tests (Depends-on): Likewise.
+2023-10-12 Bruno Haible <bruno@clisp.org>
+
+ *printf tests: Test printing of signalling NaNs.
+ These tests run without sigfpe_on_invalid(), therefore they won't crash.
+ * tests/test-vasnprintf-posix.c: Include snan.h.
+ (test_function): For each test case that uses NaNd or NaNl, add a test
+ case with SNaNd or SNaNl, respectively.
+ * tests/test-vasprintf-posix.c: Likewise.
+ * tests/test-snprintf-posix.h: Likewise.
+ * tests/test-sprintf-posix.h: Likewise.
+ * tests/test-vasnwprintf-posix.c: Likewise.
+ * modules/vasnprintf-posix-tests (Depends-on): Add snan.
+ * modules/vasprintf-posix-tests (Depends-on): Likewise.
+ * modules/vsnprintf-posix-tests (Depends-on): Likewise.
+ * modules/snprintf-posix-tests (Depends-on): Likewise.
+ * modules/vsprintf-posix-tests (Depends-on): Likewise.
+ * modules/sprintf-posix-tests (Depends-on): Likewise.
+ * modules/vasnwprintf-posix-tests (Depends-on): Likewise.
+ * modules/pipe-filter-gi-tests (Depends-on): Likewise.
+ * modules/pipe-filter-ii-tests (Depends-on): Likewise.
+
2023-10-12 Bruno Haible <bruno@clisp.org>
nan, snan tests: Avoid test failures.
Depends-on:
binary-io
c-ctype
+snan
read-file
full-write
usleep
Depends-on:
binary-io
c-ctype
+snan
read-file
full-write
stdint
float
nan
+snan
configure.ac:
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
stdint
float
nan
+snan
configure.ac:
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
stdint
float
nan
+snan
setlocale
configure.ac:
stdint
float
nan
+snan
setlocale
wcscmp
wcsspn
stdint
float
nan
+snan
configure.ac:
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
stdint
float
nan
+snan
configure.ac:
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
stdint
float
nan
+snan
configure.ac:
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%a %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Rounding near the decimal point. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%La %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%f %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%Lf %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%F %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* FLAG_ZERO. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%LF %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* FLAG_ZERO. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%e %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%Le %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%g %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%Lg %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%a %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Rounding near the decimal point. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%La %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%f %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%Lf %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%F %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* FLAG_ZERO. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%LF %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* FLAG_ZERO. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%e %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%Le %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%g %d", SNaNd (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
{ /* Width. */
int retval =
&& strcmp (result + strlen (result) - 3, " 33") == 0);
ASSERT (retval == strlen (result));
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ int retval =
+ my_sprintf (result, "%Lg %d", SNaNl (), 33, 44, 55);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%a %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* Rounding near the decimal point. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%La %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%f %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%Lf %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%F %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%LF %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%e %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%Le %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%g %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%Lg %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%a %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* Rounding near the decimal point. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%La %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%f %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%Lf %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%F %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 1)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%LF %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 1)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%e %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%Le %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%g %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
size_t length;
ASSERT (length == wcslen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%Lg %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcslen (result) >= 3 + 3
+ && wcsisnan (result, 0, wcslen (result) - 3, 0)
+ && wcscmp (result + wcslen (result) - 3, L" 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%a %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* Rounding near the decimal point. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%La %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%f %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%Lf %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%F %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%LF %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 1)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* FLAG_ZERO. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%e %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%Le %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNAND
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%g %d", SNaNd (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
{ /* Width. */
char *result;
ASSERT (retval == strlen (result));
free (result);
}
+#if HAVE_SNANL
+ { /* Signalling NaN. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%Lg %d", SNaNl (), 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strlen (result) >= 3 + 3
+ && strisnan (result, 0, strlen (result) - 3, 0)
+ && strcmp (result + strlen (result) - 3, " 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+#endif
#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
{ /* Quiet NaN. */
static union { unsigned int word[4]; long double value; } x =