diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-11-14 17:52:26 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-11-14 17:52:26 +0000 |
commit | 2e64ec9c9eac3aeb70f7cfa2392846c87c28068e (patch) | |
tree | ac6498ad9e92047fdcb0c4c375e68e7ef6e13f50 /extra-lib.mk | |
parent | ec72135e5f1d061cb5cf7cd1b855fd6290be10d9 (diff) | |
download | glibc-2e64ec9c9eac3aeb70f7cfa2392846c87c28068e.zip glibc-2e64ec9c9eac3aeb70f7cfa2392846c87c28068e.tar.gz glibc-2e64ec9c9eac3aeb70f7cfa2392846c87c28068e.tar.bz2 |
Fix string/tester.c build with GCC 8.
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.
Diffstat (limited to 'extra-lib.mk')
0 files changed, 0 insertions, 0 deletions