From nobody Fri Apr 26 08:25:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487426230805443.45172895807; Sat, 18 Feb 2017 05:57:10 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1IDqine039750; Sat, 18 Feb 2017 08:52:46 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1IDqhi8023686 for ; Sat, 18 Feb 2017 08:52:43 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1IDqh0C023627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 18 Feb 2017 08:52:43 -0500 Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED2ACC057FA7 for ; Sat, 18 Feb 2017 13:52:41 +0000 (UTC) Received: by mail-lf0-f66.google.com with SMTP id q89so5727824lfi.1 for ; Sat, 18 Feb 2017 05:52:40 -0800 (PST) Received: from kloomba.my.domain ([31.29.239.51]) by smtp.gmail.com with ESMTPSA id b145sm3400428lfg.46.2017.02.18.05.52.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 05:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bFnHU3YpU+beqq6OleniH5vrsgXRAqxRhlZdZAfV8mo=; b=iMQB2WsxS5e0qvw9AL9x+SbXiATajI0vdHfpc5e908Qh/hpDdr1gqtXnD9Zy+4byXa Tuh79pywYCRGndeqY18m/qppDkN3KuEqVNSrohz2tf99AZ8TixmuLeu0w07bxy7rwWnd E+2ugPZtIICTC7BcuHXE0yX4jolOECkAHoqpJ4yRDwU82QTDGKUrPmIi3fQZXUT5CwB5 mpMfPyvoqRXR3Nof2ROzHtFVuEB8C0A9IvjSMQtkLhm1MYKwURx03i/nVCTNE+q7IfLj xdZywL7Y1DIvor+4Z+V6Ur1A+nsv+JKooZ8giTHrgqjjbCfcR+cpOwm3nnQS+/qxLdmF 1r9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bFnHU3YpU+beqq6OleniH5vrsgXRAqxRhlZdZAfV8mo=; b=LDl/FP2CfrDTvCc6tZv3OidrYK/wag1l9DS+30k1w4arCRp6fTwm3z2agySYZXf8Tq axy/3d8BZoLzHYPNP5GHYqNERT/Sqe2e2L2f48R38BVJ7QZMTBX2my2tSlSOJlqDbmQV tCoXvOjX9q78cIBI1IQDNmU/vMkeJeLLFYEgWxPpts89xcfTmJ1bVu2HNaM4dVD/IhvO ikDn6kKLWz3p70dPNt+VzX2LXc3cS7NR6PNcjoI10HhcegNT7ELJYaW7qt0hrxswdaOt gFgfe99K4j7X5DSdJ/47qAxPfINw2/8kCMYXp0SYdk9lE6egE+T/Aes2JQrgFtSopSks jgeQ== X-Gm-Message-State: AMke39lVh884RjO1/2SwL7qt2CxiknzmWU32zPXKPq//0umfAXACLT1NFbmVOiohfhVGnA== X-Received: by 10.46.71.140 with SMTP id u134mr3299170lja.16.1487425959302; Sat, 18 Feb 2017 05:52:39 -0800 (PST) From: Roman Bogorodskiy To: libvir-list@redhat.com Date: Sat, 18 Feb 2017 17:52:11 +0400 Message-Id: <20170218135211.15482-1-bogorodskiy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 18 Feb 2017 13:52:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 18 Feb 2017 13:52:42 +0000 (UTC) for IP:'209.85.215.66' DOMAIN:'mail-lf0-f66.google.com' HELO:'mail-lf0-f66.google.com' FROM:'bogorodskiy@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.67 (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.66 mail-lf0-f66.google.com 209.85.215.66 mail-lf0-f66.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-loop: libvir-list@redhat.com Cc: Roman Bogorodskiy Subject: [libvirt] [PATCH] nodedev: fix build with clang X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Build fails with: conf/node_device_conf.c:825:62: error: comparison of unsigned enum expressi= on < 0 is always false [-Werror,-Wtautological-compare] if ((data->drm.type =3D virNodeDevDRMTypeFromString(type)) < 0) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ conf/node_device_conf.c:1801:59: error: comparison of unsigned enum express= ion < 0 is always false [-Werror,-Wtautological-compare] if ((type =3D virNodeDevDevnodeTypeFromString(tmp)) < 0) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ 2 errors generated. Fix by using intermediate variable to store the result similarly to how it's done for other FromString* calls. --- Pushed under the build-breaker rule. src/conf/node_device_conf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b3063d9ec..c15c917a2 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -814,7 +814,7 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, virNodeDevCapDataPtr data) { xmlNodePtr orignode; - int ret =3D -1; + int ret =3D -1, val; char *type =3D NULL; =20 orignode =3D ctxt->node; @@ -822,11 +822,12 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, =20 type =3D virXPathString("string(./type[1])", ctxt); =20 - if ((data->drm.type =3D virNodeDevDRMTypeFromString(type)) < 0) { + if ((val =3D virNodeDevDRMTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown drm type '%s' for '%s'"), type, def->nam= e); goto out; } + data->drm.type =3D val; =20 ret =3D 0; =20 @@ -1791,6 +1792,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, xmlNodePtr node =3D nodes[i]; char *tmp =3D virXMLPropString(node, "type"); virNodeDevDevnodeType type; + int val; =20 if (!tmp) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1798,12 +1800,13 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, goto error; } =20 - if ((type =3D virNodeDevDevnodeTypeFromString(tmp)) < 0) { + if ((val =3D virNodeDevDevnodeTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown devnode type '%s'"), tmp); VIR_FREE(tmp); goto error; } + type =3D val; =20 switch (type) { case VIR_NODE_DEV_DEVNODE_DEV: --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list