From patchwork Tue Aug 9 19:02:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9272073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E0B760754 for ; Tue, 9 Aug 2016 19:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FA20283DF for ; Tue, 9 Aug 2016 19:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 345EB283F2; Tue, 9 Aug 2016 19:05:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B274283DF for ; Tue, 9 Aug 2016 19:05:43 +0000 (UTC) Received: from localhost ([::1]:37531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCLO-0001ql-Lc for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Aug 2016 15:05:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCIN-0007fJ-RG for qemu-devel@nongnu.org; Tue, 09 Aug 2016 15:02:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXCIL-0002gi-OK for qemu-devel@nongnu.org; Tue, 09 Aug 2016 15:02:34 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:35119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXCIL-0002gb-K7 for qemu-devel@nongnu.org; Tue, 09 Aug 2016 15:02:33 -0400 Received: by mail-yw0-x242.google.com with SMTP id r9so912672ywg.2 for ; Tue, 09 Aug 2016 12:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k9ne+vRrDlCz43e5Z5AhopGNrbIGq44tg1LRMN5EuP4=; b=DUaxsdRvhao3MwxKyi+0LH1OGCryDSAazipbF8tT+xm9nnxC7DezCZ2xP4mXlOfdht 1kiq/iSbw4XjRz/Zhnboahc0peFq0G3za1SKA/2ZIHAZ2r+r4ixKa0e1WWIDXngfVPBN rpS6YK3/Bn/l/HuYp7hj2vTLNlmAzsG+6/xRQ4atpaGAFUxSDdhGD5h7nAqVIfrQneA8 H06saLS274J5GFeIj4Q4nVJF+IG0QTHAn+DR8XlMtZ5xD6C8wh9ZwozqyywrTJ+yBIrs LnoHCmBIKxsCDr331Yk2e7+FGAPh60nBGeJ4izCLEmLFURRmSjjGDdgOYylkSx4XLRzU 4ztg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k9ne+vRrDlCz43e5Z5AhopGNrbIGq44tg1LRMN5EuP4=; b=SAP9BislhPfWT/pYeNuKMsculNhLe06Nw0CDqbk7TszJSA/cPaDR9W1KMHZzlYhTON NF7NwpN+zi2tGLRfzrMi0wULJkmBprkydItATIZvjbQy35HMK0usW9kPt45zH9UFbDaY xA92tm3c7bDhV916j3UUWcApgzvv8/EPVxiioIgo7v3DU2yRQBU8dxpc+mvefnmAztTe hgBwVfVKfi5wS5c3FA6GXNIjpvUS+DCiqbok4t2q3cwz9k9mdLMNgEz4uhq4zf1x8kla tZtbbHvEWA47XXvD1XLUKUVhqsjF4dycaZGgvmab6lICWgZOwEq7rjZIYlc+6JttyFcn 2UYg== X-Gm-Message-State: AEkoouusKqVVJalxvhtAWgn88UJQPnBeXdYG2QtoLh95TZz/8sR5owvcsBzgCjqGVzBRTw== X-Received: by 10.13.208.133 with SMTP id s127mr65183934ywd.250.1470769353145; Tue, 09 Aug 2016 12:02:33 -0700 (PDT) Received: from evgadesktop.attlocal.net (108-232-152-155.lightspeed.tukrga.sbcglobal.net. [108.232.152.155]) by smtp.gmail.com with ESMTPSA id t67sm16659070ywa.33.2016.08.09.12.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 12:02:32 -0700 (PDT) From: Pranith Kumar To: Markus Armbruster , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Peter Maydell , "Daniel P. Berrange" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , qemu-devel@nongnu.org (open list:All patches CC here) Date: Tue, 9 Aug 2016 15:02:26 -0400 Message-Id: <20160809190229.27871-3-bobby.prani@gmail.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160809190229.27871-1-bobby.prani@gmail.com> References: <20160809190229.27871-1-bobby.prani@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [PATCH 3/5] Disable warn about left shifts of negative values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It seems like there's no good reason for the compiler to exploit the undefinedness of left shifts. GCC explicitly documents that they do not use at all this possibility and, while they also say this is subject to change, they have been saying this for 10 years (since the wording appeared in the GCC 4.0 manual). Disable these warnings by passing in -Wno-shift-negative-value. Cc: Peter Maydell Cc: Markus Armbruster Cc: Laszlo Ersek Signed-off-by: Paolo Bonzini [pranith: forward-port part of patch to 2.7] Signed-off-by: Pranith Kumar --- HACKING | 4 ++++ configure | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HACKING b/HACKING index 058aa8f..20a9101 100644 --- a/HACKING +++ b/HACKING @@ -158,6 +158,10 @@ painful. These are: * you may assume that right shift of a signed integer duplicates the sign bit (ie it is an arithmetic shift, not a logical shift) +In addition, QEMU assumes that the compiler does not use the latitude +given in C99 and C11 to treat aspects of signed '<<' as undefined, as +documented in the GNU Compiler Collection manual starting at version 4.0. + 7. Error handling and reporting 7.1 Reporting errors to the human user diff --git a/configure b/configure index f57fcc6..8d84919 100755 --- a/configure +++ b/configure @@ -1452,7 +1452,7 @@ fi gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" -gcc_flags="-Wendif-labels $gcc_flags" +gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags="-Wno-initializer-overrides $gcc_flags" gcc_flags="-Wno-string-plus-int $gcc_flags" # Note that we do not add -Werror to gcc_flags here, because that would