[PATCH] Fix gcc 9 build errors for make xcheck.
Stefan Liebler
stli@linux.ibm.com
Tue Jun 18 07:41:00 GMT 2019
On 6/17/19 8:11 PM, DJ Delorie wrote:
>
> 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 :-)
:-) Removed.
>
>> - 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 :-)
Changed all to "(NULL)".
>
>> 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.
Yes, it does not hurt. Added this check.
> >> 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.
>
Bye
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20190618_0935_gcc9warnings.patch
Type: text/x-patch
Size: 4580 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20190618/e252d911/attachment.bin>
More information about the Libc-alpha
mailing list