mirror of git://sourceware.org/git/glibc.git
GCC 8 warns about more cases of string functions truncating their output or not copying a trailing NUL byte. This patch fixes testsuite build failures caused by such warnings in string/tester.c. In general, the warnings are disabled around the relevant calls using DIAG_* macros, since the relevant cases are being deliberately tested. In one case, the warning is with -Wstringop-overflow= instead of -Wstringop-truncation; in that case, the conditional is __GNUC_PREREQ (7, 0) (being the version where -Wstringop-overflow= was introduced), to allow the conditional to be removed sooner, since it's harmless to disable the warning for a GCC version where it doesn't actually occur. In the case of warnings for strncpy calls in test_memcmp, the calls in question are changed to use memcpy, as they don't copy a trailing NUL and the point of that code is to test memcmp rather than strncpy. Tested (compilation) with GCC 8 for x86_64-linux-gnu with build-many-glibcs.py (in conjunction with Martin's patch to allow glibc to build). * string/tester.c (test_stpncpy): Disable -Wstringop-truncation for stpncpy calls for GCC 8. (test_strncat): Disable -Wstringop-truncation warning for strncat calls for GCC 8. Disable -Wstringop-overflow= warning for one strncat call for GCC 7. (test_strncpy): Disable -Wstringop-truncation warning for strncpy calls for GCC 8. (test_memcmp): Use memcpy instead of strncpy for calls not copying trailing NUL. |
||
|---|---|---|
| .. | ||
| bits | ||
| Depend | ||
| Makefile | ||
| Versions | ||
| _strerror.c | ||
| argz-addsep.c | ||
| argz-append.c | ||
| argz-count.c | ||
| argz-create.c | ||
| argz-ctsep.c | ||
| argz-delete.c | ||
| argz-extract.c | ||
| argz-insert.c | ||
| argz-next.c | ||
| argz-replace.c | ||
| argz-stringify.c | ||
| argz.h | ||
| basename.c | ||
| bcopy.c | ||
| bug-envz1.c | ||
| bug-strcoll1.c | ||
| bug-strcoll2.c | ||
| bug-strncat1.c | ||
| bug-strpbrk1.c | ||
| bug-strspn1.c | ||
| bug-strtok1.c | ||
| byteswap.h | ||
| bzero.c | ||
| endian.h | ||
| envz.c | ||
| envz.h | ||
| explicit_bzero.c | ||
| ffs.c | ||
| ffsll.c | ||
| inl-tester.c | ||
| memccpy.c | ||
| memchr.c | ||
| memcmp.c | ||
| memcpy.c | ||
| memfrob.c | ||
| memmem.c | ||
| memmove.c | ||
| memory.h | ||
| mempcpy.c | ||
| memrchr.c | ||
| memset.c | ||
| noinl-tester.c | ||
| rawmemchr.c | ||
| stpcpy.c | ||
| stpncpy.c | ||
| str-two-way.h | ||
| stratcliff.c | ||
| strcasecmp.c | ||
| strcasecmp_l.c | ||
| strcasestr.c | ||
| strcat.c | ||
| strchr.c | ||
| strchrnul.c | ||
| strcmp.c | ||
| strcoll.c | ||
| strcoll_l.c | ||
| strcpy.c | ||
| strcspn.c | ||
| strdup.c | ||
| strerror.c | ||
| strerror_l.c | ||
| strfry.c | ||
| string-inlines.c | ||
| string.h | ||
| strings.h | ||
| strlen.c | ||
| strncase.c | ||
| strncase_l.c | ||
| strncat.c | ||
| strncmp.c | ||
| strncpy.c | ||
| strndup.c | ||
| strnlen.c | ||
| strpbrk.c | ||
| strrchr.c | ||
| strsep.c | ||
| strsignal.c | ||
| strspn.c | ||
| strstr.c | ||
| strtok.c | ||
| strtok_r.c | ||
| strverscmp.c | ||
| strxfrm.c | ||
| strxfrm_l.c | ||
| swab.c | ||
| test-bcopy.c | ||
| test-bzero.c | ||
| test-endian-types.c | ||
| test-explicit_bzero.c | ||
| test-ffs.c | ||
| test-memccpy.c | ||
| test-memchr.c | ||
| test-memcmp.c | ||
| test-memcpy.c | ||
| test-memmem.c | ||
| test-memmove.c | ||
| test-mempcpy.c | ||
| test-memrchr.c | ||
| test-memset.c | ||
| test-rawmemchr.c | ||
| test-stpcpy.c | ||
| test-stpncpy.c | ||
| test-strcasecmp.c | ||
| test-strcasestr.c | ||
| test-strcat.c | ||
| test-strchr.c | ||
| test-strchrnul.c | ||
| test-strcmp.c | ||
| test-strcpy.c | ||
| test-strcspn.c | ||
| test-string.h | ||
| test-strlen.c | ||
| test-strncasecmp.c | ||
| test-strncat.c | ||
| test-strncmp.c | ||
| test-strncpy.c | ||
| test-strnlen.c | ||
| test-strpbrk.c | ||
| test-strrchr.c | ||
| test-strspn.c | ||
| test-strstr.c | ||
| testcopy.c | ||
| tester.c | ||
| tst-bswap.c | ||
| tst-cmp.c | ||
| tst-endian.c | ||
| tst-inlcall.c | ||
| tst-strcoll-overflow.c | ||
| tst-strfry.c | ||
| tst-strlen.c | ||
| tst-strtok.c | ||
| tst-strtok_r.c | ||
| tst-strxfrm.c | ||
| tst-strxfrm2.c | ||
| tst-svc.c | ||
| tst-svc.expect | ||
| tst-svc.input | ||
| tst-svc2.c | ||
| tst-xbzero-opt.c | ||
| wordcopy.c | ||
| xpg-strerror.c | ||