From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZK7h-0002XE-FM for qemu-devel@nongnu.org; Tue, 18 Dec 2018 13:29:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZK7g-0005bZ-Hi for qemu-devel@nongnu.org; Tue, 18 Dec 2018 13:29:41 -0500 References: <20181218175122.3229-1-philmd@redhat.com> <20181218175122.3229-2-philmd@redhat.com> From: Eric Blake Message-ID: Date: Tue, 18 Dec 2018 12:29:01 -0600 MIME-Version: 1.0 In-Reply-To: <20181218175122.3229-2-philmd@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 1/5] qemu/compiler: Define QEMU_NONSTRING List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Juan Quintela , qemu-block@nongnu.org, 1803872@bugs.launchpad.net, =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , "Dr. David Alan Gilbert" , Howard Spoelstra , Jeff Cody , David Hildenbrand , Paolo Bonzini , Stefan Weil , Markus Armbruster , Kevin Wolf , Ben Pye , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Thomas Huth , Igor Mammedov , Liu Yuan , David Gibson , Max Reitz On 12/18/18 11:51 AM, Philippe Mathieu-Daud=C3=A9 wrote: > GCC 8 introduced the -Wstringop-truncation checker to detect truncation= by > the strncat and strncpy functions (closely related to -Wstringop-overfl= ow, > which detect buffer overflow by string-modifying functions declared in > ). This paragraph talks about a new warning checker, but makes no mention=20 of an attribute. >=20 > Add the QEMU_NONSTRING macro which checks if the compiler supports this > attribute. Thus, "this attribute" has no antecedent; did you forget to add a=20 sentence to the previous paragraph, or maybe put the mention of adding=20 QEMU_NONSTRING after... >=20 >>>From the GCC manual [*]: >=20 > The nonstring variable attribute specifies that an object or member > declaration with type array of char, signed char, or unsigned char, > or pointer to such a type is intended to store character arrays that > do not necessarily contain a terminating NUL. This is useful in dete= cting > uses of such arrays or pointers with functions that expect NUL-termi= nated > strings, and to avoid warnings when such an array or pointer is used= as > an argument to a bounded string manipulation function such as strncp= y. ...the explanation of how the attribute was added in tandem with the new=20 warning checker for silencing specific instances of the warning? >=20 > [*] https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#= index-nonstring-variable-attribute >=20 > Suggested-by: Michael S. Tsirkin > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > include/qemu/compiler.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) >=20 Reviewed-by: Eric Blake --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org