From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZLFX-00059r-Ce for qemu-devel@nongnu.org; Tue, 18 Dec 2018 14:41:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZL2n-00027D-Ox for qemu-devel@nongnu.org; Tue, 18 Dec 2018 14:28:45 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZL2n-00023f-HX for qemu-devel@nongnu.org; Tue, 18 Dec 2018 14:28:41 -0500 Received: by mail-wm1-f65.google.com with SMTP id f81so3968988wmd.4 for ; Tue, 18 Dec 2018 11:28:41 -0800 (PST) References: <20181218175122.3229-1-philmd@redhat.com> <20181218175122.3229-2-philmd@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: Date: Tue, 18 Dec 2018 20:28:38 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Eric Blake , 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 7:29 PM, Eric Blake wrote: > On 12/18/18 11:51 AM, Philippe Mathieu-Daudé wrote: >> GCC 8 introduced the -Wstringop-truncation checker to detect >> truncation by >> the strncat and strncpy functions (closely related to >> -Wstringop-overflow, >> which detect buffer overflow by string-modifying functions declared in >> ). > > This paragraph talks about a new warning checker, but makes no mention > of an attribute. > >> >> 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 > sentence to the previous paragraph, or maybe put the mention of adding > QEMU_NONSTRING after... > >> >>> From the GCC manual [*]: >> >>    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 >> detecting >>    uses of such arrays or pointers with functions that expect >> NUL-terminated >>    strings, and to avoid warnings when such an array or pointer is >> used as >>    an argument to a bounded string manipulation function such as strncpy. > > ...the explanation of how the attribute was added in tandem with the new > warning checker for silencing specific instances of the warning? Yes... I will rewrite this. > >> >> [*] >> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-nonstring-variable-attribute >> >> >> Suggested-by: Michael S. Tsirkin >> Signed-off-by: Philippe Mathieu-Daudé >> --- >>   include/qemu/compiler.h | 15 +++++++++++++++ >>   1 file changed, 15 insertions(+) >> > > Reviewed-by: Eric Blake Thanks!