Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5348902ybg; Tue, 22 Oct 2019 01:41:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqYM0ul9ow8xGBzH5zVM4p+lxqot96EW77YP1kfC1mHlA0KoLJLnm1DBRT1JxJmh5nAE2s X-Received: by 2002:a50:f744:: with SMTP id j4mr29586251edn.73.1571733699240; Tue, 22 Oct 2019 01:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571733699; cv=none; d=google.com; s=arc-20160816; b=Zq8/rPcpaE9mNjghshVuz6ss+F8LAZKAIB3jlo8wBw9VeGlgx0IdNZc/jA9G3PJwQw U0eXV1jbwdea6uxogNe+2OWC0ldClkLuUXKy7etXRHe2vCrtGymEuj++uXdj//oR0GEb leey51PvBGV/SYwPHBFRqb0xXZ9xQT8omoqMidH3x37hCPiscktuMv0WT2mGG6A2XeFa v5a2mZ6SmTRwRr1XHSUkGDaa1HFymgFDu2C+O9LcadEjz45ep8holwdBTaJ9WIWl9HO9 HiFEML0ipXJdr+8I1mnMF+YYS+3AwJrzHfnBlN0X/B/bbiTlNB7LbHAkmDcugv0jziY/ AwVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=xuCgV4YUFYa6Caw2Y7xISyDpnVmWYzdkWcO2116lWE4=; b=A7X6n3IBOApc3Pl5W65HyJ5ln5gIDKTIUOkpQ2skDSsMJeoqYw2VWdAkDJu+HS+J79 AcgAdRBrXH1YEYY4DGRjAeIeyXpPrL8+TWy6Ej00H+MeStcdjYqhc4ukcb5io9r6RZTY vAd5NZnp/q2OYRsEMO4u0YadatOunjDa8Lnbd2qdX4cwIqNm3mRwjklptH/wHGp4dgmO x4tE3/zo7ayJomh9mvpR+yWT8PlITaTCdw823VAmVq5R2vNrLj4UJeOOo82kxO8WmSzH f3HDpgK8nl4wpGWVw3c/R+azDKr3dnmQ6VblEOVy0Nw0kIn5Th4mVbXOS2x6p6jh4/uB sKog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=giNNnQgA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si2602032edc.1.2019.10.22.01.41.15; Tue, 22 Oct 2019 01:41:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=giNNnQgA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388286AbfJVIhb (ORCPT + 99 others); Tue, 22 Oct 2019 04:37:31 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36035 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731242AbfJVIha (ORCPT ); Tue, 22 Oct 2019 04:37:30 -0400 Received: by mail-wr1-f65.google.com with SMTP id w18so16466888wrt.3 for ; Tue, 22 Oct 2019 01:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=xuCgV4YUFYa6Caw2Y7xISyDpnVmWYzdkWcO2116lWE4=; b=giNNnQgAjHNft/0FgO/AAhey9WyM3sxbadX7UZAgHpUwSifwzOZJ53L+/otOLfZy1b HbgoaElE/oR4BlnRE2UoC/++L7XXQOdCTshf8W5PhHihnq/lRnMl+sepQsVLnOMqPfuc Fn5Pj1o0zLvx9mlVr+ApFuiwJwEmfTyGh9RRI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=xuCgV4YUFYa6Caw2Y7xISyDpnVmWYzdkWcO2116lWE4=; b=fH9GLxYjr+wFVYi0vBmOzhMq2Jm5Zlu6FZJfD95UNIhtKI3WanuDG3mEUNMwvfyOJI kda+DBnEFpTknAswaeRbansClfXpYDF5auJHPO3nD5a9cB3aaU1KZ/yHnAcJYzmcSIl0 UFAqAcW/PDlRlilLDmLb5ukWXsY08x0qdkAOViujFiQFDqjJ8mimpSoIrnYtTSgfVFo4 SoDgz5dXVc+Bp7722D6UwsISx/LCtL1sJ3aQWEZDYZ8dWEQHxcFrMD5WXPr/4Mb+FHSa yfMl4sdlu1V1FAVp0TNFfgCC9d0qOCSonYIagZ/1vSgFnFkVowhPV4jrMusdThecIUlG CyNw== X-Gm-Message-State: APjAAAUlIj0yFjDq3HOEdlAbKPN6JEBaZT6Pjuh/BpLTBNExYohSPICv mbAdF6B0aW+CA3d/44oHbEUFpg== X-Received: by 2002:a5d:6a03:: with SMTP id m3mr420075wru.90.1571733447653; Tue, 22 Oct 2019 01:37:27 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id p12sm4910430wrt.7.2019.10.22.01.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 01:37:26 -0700 (PDT) Date: Tue, 22 Oct 2019 10:37:25 +0200 From: Daniel Vetter To: Benjamin Gaignard Cc: airlied@linux.ie, daniel@ffwll.ch, ville.syrjala@linux.intel.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2] drm: atomic helper: fix W=1 warnings Message-ID: <20191022083725.GW11828@phenom.ffwll.local> Mail-Followup-To: Benjamin Gaignard , airlied@linux.ie, ville.syrjala@linux.intel.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20191008124254.2144-1-benjamin.gaignard@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191008124254.2144-1-benjamin.gaignard@st.com> X-Operating-System: Linux phenom 5.2.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 08, 2019 at 02:42:54PM +0200, Benjamin Gaignard wrote: > Few for_each macro set variables that are never used later which led > to generate unused-but-set-variable warnings. > Add (void)(foo) inside the macros to remove these warnings > > Signed-off-by: Benjamin Gaignard OCD in me would lean towards annotating all of them, unconditionally, and be done. But I guess this works too. Either way: Reviewed-by: Daniel Vetter > --- > include/drm/drm_atomic.h | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h > index 927e1205d7aa..b6c73fd9f55a 100644 > --- a/include/drm/drm_atomic.h > +++ b/include/drm/drm_atomic.h > @@ -693,6 +693,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->connectors[__i].ptr && \ > ((connector) = (__state)->connectors[__i].ptr, \ > + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ > (old_connector_state) = (__state)->connectors[__i].old_state, \ > (new_connector_state) = (__state)->connectors[__i].new_state, 1)) > > @@ -714,6 +715,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->connectors[__i].ptr && \ > ((connector) = (__state)->connectors[__i].ptr, \ > + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ > (old_connector_state) = (__state)->connectors[__i].old_state, 1)) > > /** > @@ -734,7 +736,9 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->connectors[__i].ptr && \ > ((connector) = (__state)->connectors[__i].ptr, \ > - (new_connector_state) = (__state)->connectors[__i].new_state, 1)) > + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ > + (new_connector_state) = (__state)->connectors[__i].new_state, \ > + (void)(new_connector_state) /* Only to avoid unused-but-set-variable warning */, 1)) > > /** > * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update > @@ -754,7 +758,9 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->crtcs[__i].ptr && \ > ((crtc) = (__state)->crtcs[__i].ptr, \ > + (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \ > (old_crtc_state) = (__state)->crtcs[__i].old_state, \ > + (void)(old_crtc_state) /* Only to avoid unused-but-set-variable warning */, \ > (new_crtc_state) = (__state)->crtcs[__i].new_state, 1)) > > /** > @@ -793,7 +799,9 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->crtcs[__i].ptr && \ > ((crtc) = (__state)->crtcs[__i].ptr, \ > - (new_crtc_state) = (__state)->crtcs[__i].new_state, 1)) > + (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \ > + (new_crtc_state) = (__state)->crtcs[__i].new_state, \ > + (void)(new_crtc_state) /* Only to avoid unused-but-set-variable warning */, 1)) > > /** > * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update > @@ -813,6 +821,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->planes[__i].ptr && \ > ((plane) = (__state)->planes[__i].ptr, \ > + (void)(plane) /* Only to avoid unused-but-set-variable warning */, \ > (old_plane_state) = (__state)->planes[__i].old_state,\ > (new_plane_state) = (__state)->planes[__i].new_state, 1)) > > @@ -873,7 +882,9 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); > (__i)++) \ > for_each_if ((__state)->planes[__i].ptr && \ > ((plane) = (__state)->planes[__i].ptr, \ > - (new_plane_state) = (__state)->planes[__i].new_state, 1)) > + (void)(plane) /* Only to avoid unused-but-set-variable warning */, \ > + (new_plane_state) = (__state)->planes[__i].new_state, \ > + (void)(new_plane_state) /* Only to avoid unused-but-set-variable warning */, 1)) > > /** > * for_each_oldnew_private_obj_in_state - iterate over all private objects in an atomic update > -- > 2.15.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch