From nobody Sat May 4 10:38:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543344797948668.4080002607403; Tue, 27 Nov 2018 10:53:17 -0800 (PST) Received: from localhost ([::1]:43991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRiTp-0002ZJ-Ni for importer@patchew.org; Tue, 27 Nov 2018 13:53:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRiSC-0001of-1H for qemu-devel@nongnu.org; Tue, 27 Nov 2018 13:51:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRiQW-0006uG-7m for qemu-devel@nongnu.org; Tue, 27 Nov 2018 13:49:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRiQS-0006t5-RM; Tue, 27 Nov 2018 13:49:36 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01B563154862; Tue, 27 Nov 2018 18:49:35 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-2.bos.redhat.com [10.18.17.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 798375D6A9; Tue, 27 Nov 2018 18:49:31 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:49:29 -0500 Message-Id: <20181127184929.20065-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 27 Nov 2018 18:49:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] scsi: Address spurious clang warning 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: qemu-trivial@nongnu.org, peter.maydell@linaro.org, John Snow , qemu-block@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some versions of Clang prior to 6.0 (and some builds of clang after, such as 6.0.1-2.fc28) fail to recognize { 0 } as a valid initializer for a struct with subobjects when -Wmissing-braces is enabled. https://bugs.llvm.org/show_bug.cgi?id=3D21689 and https://reviews.llvm.org/rL314499 suggests this should be fixed in 6.0, but it might not be the case for older versions or downstream versions. For now, follow the precedent of ebf2a499 and replace the standard { 0 } with the accepted { } to silence this warning and allow the build to work under clang 6.0.1-2.fc28, and builds prior to 6.0. Signed-off-by: John Snow Reviewed-by: Eric Blake --- What I am actually less clear on is why this appears to be a problem only now; since the introduction of { 0 } was in 2.11. It might be a regression only in the fedora distribution of Clang 6.0. With apologies to Paolo, who hates these patches. --- scsi/qemu-pr-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index ce40008bfc..e7af637232 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -236,7 +236,7 @@ static void dm_init(void) perror("Cannot open " CONTROL_PATH); exit(1); } - struct dm_ioctl dm =3D { 0 }; + struct dm_ioctl dm =3D { }; if (!dm_ioctl(DM_VERSION, &dm)) { perror("ioctl"); exit(1); --=20 2.17.2