From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9w1C-0001hj-7V for qemu-devel@nongnu.org; Tue, 09 Oct 2018 13:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9w17-0003t3-Lf for qemu-devel@nongnu.org; Tue, 09 Oct 2018 13:42:02 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:35728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g9w17-0003sc-2d for qemu-devel@nongnu.org; Tue, 09 Oct 2018 13:41:57 -0400 Received: by mail-pg1-x544.google.com with SMTP id v133-v6so1171417pgb.2 for ; Tue, 09 Oct 2018 10:41:56 -0700 (PDT) References: <20181009161814.21257-1-peter.maydell@linaro.org> From: Richard Henderson Message-ID: Date: Tue, 9 Oct 2018 10:41:52 -0700 MIME-Version: 1.0 In-Reply-To: <20181009161814.21257-1-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Suppress address-of-packed-member warnings in __get/put_user_e List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Riku Voipio , Laurent Vivier , patches@linaro.org On 10/9/18 9:18 AM, Peter Maydell wrote: > Our __get_user_e() and __put_user_e() macros cause newer versions > of clang to generate false-positive -Waddress-of-packed-member > warnings if they are passed the address of a member of a packed > struct (see https://bugs.llvm.org/show_bug.cgi?id=39113). > Suppress these using the _Pragma() operator. Unfortunately > _Pragma() support in gcc is broken in some gcc versions and > in some usage contexts, so we limit the pragma usage here to clang. > > To put in the pragmas we need to convert the macros from > expressions to statements, but all the callsites effectively > treat them as statements already so this is OK. > > Signed-off-by: Peter Maydell > --- > Changes v1->v2: _Pragma() in gcc appears to be a disaster area; > limit the use of it to clang only, since it's just clang that > emits the bogus warning in this case. Tested on clang-3.8.0, > clang-7, gcc 5.4.0 and gcc 8.0.1. > > linux-user/qemu.h | 70 ++++++++++++++++++++++++++++++++++------------- > 1 file changed, 51 insertions(+), 19 deletions(-) Reviewed-by: Richard Henderson r~