This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix gcc 9 build errors for make xcheck.
- From: DJ Delorie <dj at redhat dot com>
- To: Stefan Liebler <stli at linux dot ibm dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 17 Jun 2019 14:11:10 -0400
- Subject: Re: [PATCH] Fix gcc 9 build errors for make xcheck.
Stefan Liebler <stli@linux.ibm.com> writes:
> tst-field.c:52:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
> Please enter the commit message for your changes. Lines starting
Heh, double check your commit message :-)
> - char buf[10];
> + char buf[12];
-MAXINT would be "-2147483648\0" - 12 bytes. Ok.
> - for (int t = 0; t <= 3; t++)
> + for (int t = 0; t < 3; t++)
Corresponds to:
static malloc_args tests[3][NUM_ALLOCS];
So OK.
> error (0, 0, "Wrong result in function %s %s %s", impl->name,
> - res, exp_result);
> + (res == NULL) ? "NULL" : res,
> + (exp_result == NULL) ? "NULL" : exp_result);
Ok. Do we have a standard for printing NULL? I mean, other unix's
print "(null)" for example. If we're changing it anyway, a bit of
consistency would be nice. But OK anyway :-)
> printf ("FAIL: rewrite \"%s\" -> \"%s\", expected \"%s\"\n",
> - input, result, expected);
> + (input == NULL) ? "NULL" : input, result, expected);
We explicitly pass NULL for input at least once, so OK. We never pass
NULL for expected, but as for test-strcasestr.c, we should protect it
anyway. We test for result!=NULL so do not need to check that one.
> error (0, 0, "Wrong result in function %s %s %s", impl->name,
> - result, exp_result);
> + (result == NULL) ? "NULL" : result,
> + (exp_result == NULL) ? "NULL" : exp_result);
Ok.
> error (0, 0, "Wrong result in function %s %s %s", impl->name,
> - result, exp_result);
> + (result == NULL) ? "NULL" : result,
> + (exp_result == NULL) ? "NULL" : exp_result);
Ok.