The -Wstringop-truncation option new in GCC 8 detects common misuses
commit7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c
authorMartin Sebor <msebor@redhat.com>
Thu, 16 Nov 2017 00:39:59 +0000 (15 17:39 -0700)
committerMartin Sebor <msebor@redhat.com>
Thu, 16 Nov 2017 00:39:59 +0000 (15 17:39 -0700)
treec6c0117b6959160bc128ee661b3ed08420177c5e
parentd9611e308592355718b36fe085b7b61aa52911e5
The -Wstringop-truncation option new in GCC 8 detects common misuses
of the strncat and strncpy function that may result in truncating
the copied string before the terminating NUL.  To avoid false positive
warnings for correct code that intentionally creates sequences of
characters that aren't guaranteed to be NUL-terminated, arrays that
are intended to store such sequences should be decorated with a new
nonstring attribute.  This change add this attribute to Glibc and
uses it to suppress such false positives.

ChangeLog:
* misc/sys/cdefs.h (__attribute_nonstring__): New macro.
* sysdeps/gnu/bits/utmp.h (struct utmp): Use it.
* sysdeps/unix/sysv/linux/s390/bits/utmp.h (struct utmp): Same.
ChangeLog
misc/sys/cdefs.h
sysdeps/gnu/bits/utmp.h
sysdeps/unix/sysv/linux/s390/bits/utmp.h