1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00

Add unit tests and doc for the %Lf large precision issue on Solaris.

* tests/test-vasnprintf-posix.c (test_function): Add a testcase for
"%.5119Lf".
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* doc/posix-functions/*printf.texi: Document the Solaris 11.4 bug.
This commit is contained in:
Bruno Haible
2026-08-14 19:56:38 +02:00
parent 9491b2cbf7
commit 78a859110f
14 changed files with 85 additions and 10 deletions

View File

@@ -1,3 +1,14 @@
2026-08-14 Bruno Haible <bruno@clisp.org>
Add unit tests and doc for the %Lf large precision issue on Solaris.
* tests/test-vasnprintf-posix.c (test_function): Add a testcase for
"%.5119Lf".
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* doc/posix-functions/*printf.texi: Document the Solaris 11.4 bug.
2026-08-14 Pádraig Brady <P@draigBrady.com>
tests: avoid -Wformat= warning re unsigned mismatch

View File

@@ -103,7 +103,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -103,7 +103,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -102,7 +102,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -90,7 +90,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -103,7 +103,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -103,7 +103,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -99,7 +99,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -90,7 +90,7 @@ AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
This function mishandles large floating point precisions
(for example, formatting 1.0 with @samp{"%.511f"})
on some platforms:
Solaris 10.
Solaris 11.4.
@item
This function produces wrong output for the @samp{lc} directive with a NUL
wide character argument on some platforms:

View File

@@ -79,7 +79,7 @@ static void
test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{
char buf[8];
char result[5000];
char result[10000];
/* Test return value convention. */
@@ -2955,6 +2955,17 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
ASSERT (retval == strlen (result));
}
{
int retval =
my_snprintf (result, sizeof (result), "%.5119Lf %d", 1.0L, 99);
ASSERT (result[0] == '1');
ASSERT (result[1] == '.');
for (size_t i = 0; i < 5119; i++)
ASSERT (result[2 + i] == '0');
ASSERT (streq (result + 2 + 5119, " 99"));
ASSERT (retval == strlen (result));
}
{
char input[5000];
int retval;

View File

@@ -78,7 +78,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas
static void
test_function (int (*my_sprintf) (char *, const char *, ...))
{
char result[5000];
char result[10000];
char buf[8];
/* Test return value convention. */
@@ -2942,6 +2942,17 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
ASSERT (retval == strlen (result));
}
{
int retval =
my_sprintf (result, "%.5119Lf %d", 1.0L, 99);
ASSERT (result[0] == '1');
ASSERT (result[1] == '.');
for (size_t i = 0; i < 5119; i++)
ASSERT (result[2 + i] == '0');
ASSERT (streq (result + 2 + 5119, " 99"));
ASSERT (retval == strlen (result));
}
{
char input[5000];
int retval;

View File

@@ -3809,6 +3809,20 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
free (result);
}
{
size_t length;
char *result =
my_asnprintf (NULL, &length, "%.5119Lf %d", 1.0L, 99);
ASSERT (result != NULL);
ASSERT (result[0] == '1');
ASSERT (result[1] == '.');
for (size_t i = 0; i < 5119; i++)
ASSERT (result[2 + i] == '0');
ASSERT (streq (result + 2 + 5119, " 99"));
ASSERT (length == strlen (result));
free (result);
}
{
char input[5000];
size_t length;

View File

@@ -3813,6 +3813,20 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
free (result);
}
{
size_t length;
wchar_t *result =
my_asnwprintf (NULL, &length, L"%.5119Lf %d", 1.0L, 99);
ASSERT (result != NULL);
ASSERT (result[0] == '1');
ASSERT (result[1] == '.');
for (size_t i = 0; i < 5119; i++)
ASSERT (result[2 + i] == '0');
ASSERT (wcscmp (result + 2 + 5119, L" 99") == 0);
ASSERT (length == wcslen (result));
free (result);
}
{
char input[5000];
size_t length;

View File

@@ -3793,6 +3793,20 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
free (result);
}
{
char *result;
int retval =
my_asprintf (&result, "%.5119Lf %d", 1.0L, 99);
ASSERT (result != NULL);
ASSERT (result[0] == '1');
ASSERT (result[1] == '.');
for (size_t i = 0; i < 5119; i++)
ASSERT (result[2 + i] == '0');
ASSERT (streq (result + 2 + 5119, " 99"));
ASSERT (retval == strlen (result));
free (result);
}
{
char input[5000];
char *result;