mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 04:01:10 +00:00
Fix stdio-common tests for GCC 12 -Waddress
My glibc bot shows failures building the testsuite with GCC mainline across all architectures: tst-vfprintf-width-prec.c: In function 'do_test': tst-vfprintf-width-prec.c:90:16: error: the comparison will always evaluate as 'false' for the address of 'result' will never be NULL [-Werror=address] 90 | if (result == NULL) | ^~ tst-vfprintf-width-prec.c:89:13: note: 'result' declared here 89 | wchar_t result[100]; | ^~~~~~ This is clearly a correct warning; the comparison against NULL is clearly a cut-and-paste mistake from an earlier case in the test that does use calloc. Thus, remove the unnecessary check for NULL shown up by the warning. Similarly, two other tests have bogus comparisons against NULL; remove those as well: scanf14a.c:95:13: error: the comparison will always evaluate as 'false' for the address of 'fname' will never be NULL [-Werror=address] 95 | if (fname == NULL) | ^~ scanf14a.c:93:8: note: 'fname' declared here 93 | char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"]; | ^~~~~ scanf16a.c:125:13: error: the comparison will always evaluate as 'false' for the address of 'fname' will never be NULL [-Werror=address] 125 | if (fname == NULL) | ^~ scanf16a.c:123:8: note: 'fname' declared here 123 | char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"]; | ^~~~~ Tested with build-many-glibcs.py (GCC mainline) for aarch64-linux-gnu.
This commit is contained in:
parent
de0a7c5a0b
commit
a312e8fe6d
@ -92,8 +92,6 @@ main (void)
|
|||||||
|
|
||||||
char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"];
|
char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"];
|
||||||
sprintf (fname, "%s/tst-scanf14.XXXXXX", tmpdir);
|
sprintf (fname, "%s/tst-scanf14.XXXXXX", tmpdir);
|
||||||
if (fname == NULL)
|
|
||||||
FAIL ();
|
|
||||||
|
|
||||||
/* Create a temporary file. */
|
/* Create a temporary file. */
|
||||||
int fd = mkstemp (fname);
|
int fd = mkstemp (fname);
|
||||||
|
@ -122,8 +122,6 @@ main (void)
|
|||||||
|
|
||||||
char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"];
|
char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"];
|
||||||
sprintf (fname, "%s/tst-scanf16.XXXXXX", tmpdir);
|
sprintf (fname, "%s/tst-scanf16.XXXXXX", tmpdir);
|
||||||
if (fname == NULL)
|
|
||||||
FAIL ();
|
|
||||||
|
|
||||||
/* Create a temporary file. */
|
/* Create a temporary file. */
|
||||||
int fd = mkstemp (fname);
|
int fd = mkstemp (fname);
|
||||||
|
@ -87,12 +87,6 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
wchar_t result[100];
|
wchar_t result[100];
|
||||||
if (result == NULL)
|
|
||||||
{
|
|
||||||
printf ("error: calloc (%d, %zu): %m", ret + 1, sizeof (wchar_t));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = swprintf (result, 100, L"%133000.999999999x", 17);
|
ret = swprintf (result, 100, L"%133000.999999999x", 17);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user