From: Michal Hocko <mhocko@suse.cz>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Balbir Singh <bsingharora@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Marek <mmarek@suse.cz>,
linux-kbuild@vger.kernel.org
Subject: [PATCH] Makefiles: Disable unused-variable warning (was: Re: [PATCH 1/6] memcg: fix unused variable warning)
Date: Tue, 27 Dec 2011 14:57:52 +0100 [thread overview]
Message-ID: <20111227135752.GK5344@tiehlicka.suse.cz> (raw)
In-Reply-To: <1324695619-5537-1-git-send-email-kirill@shutemov.name>
On Sat 24-12-11 05:00:14, Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
>
> mm/memcontrol.c: In function ‘memcg_check_events’:
> mm/memcontrol.c:784:22: warning: unused variable ‘do_numainfo’ [-Wunused-variable]
>
> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> ---
> mm/memcontrol.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d643bd6..a5e92bd 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -781,14 +781,15 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page)
> /* threshold event is triggered in finer grain than soft limit */
> if (unlikely(mem_cgroup_event_ratelimit(memcg,
> MEM_CGROUP_TARGET_THRESH))) {
> - bool do_softlimit, do_numainfo;
> + bool do_softlimit;
>
> - do_softlimit = mem_cgroup_event_ratelimit(memcg,
> - MEM_CGROUP_TARGET_SOFTLIMIT);
> #if MAX_NUMNODES > 1
> + bool do_numainfo;
> do_numainfo = mem_cgroup_event_ratelimit(memcg,
> MEM_CGROUP_TARGET_NUMAINFO);
> #endif
> + do_softlimit = mem_cgroup_event_ratelimit(memcg,
> + MEM_CGROUP_TARGET_SOFTLIMIT);
I don't like this very much. Maybe we should get rid of both do_* and
do it with flags? But maybe it is not worth the additional code at
all...
Anyway, I am wondering why unused-but-set-variable is disabled while
unused-variable is enabled. Shouldn't we just disable it as well rather
than workaround this in the code? The warning is just pure noise in this
case.
What about something like:
---
From e1136891fe86eacf9212b2144f80ff6b75b10194 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.cz>
Date: Tue, 27 Dec 2011 14:53:06 +0100
Subject: [PATCH] Makefiles: Disable unused-variable warning
We are already disabling unused-but-set-variable and Wunused-variable
produces some noise as well.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index ea51081..25c76f3 100644
--- a/Makefile
+++ b/Makefile
@@ -578,6 +578,7 @@ endif
# This warning generated too much noise in a regular build.
# Use make W=1 to enable this warning (see scripts/Makefile.build)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
+KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
--
1.7.7.3
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
next parent reply other threads:[~2011-12-27 13:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1324695619-5537-1-git-send-email-kirill@shutemov.name>
2011-12-27 13:57 ` Michal Hocko [this message]
2011-12-27 18:26 ` [PATCH] Makefiles: Disable unused-variable warning (was: Re: [PATCH 1/6] memcg: fix unused variable warning) Kirill A. Shutemov
2011-12-29 10:42 ` Michal Hocko
2011-12-29 11:08 ` Kirill A. Shutemov
2011-12-29 11:16 ` Michal Hocko
2012-01-08 15:01 ` [PATCH] Makefiles: Disable unused-variable warning Michal Marek
2012-01-10 8:52 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111227135752.GK5344@tiehlicka.suse.cz \
--to=mhocko@suse.cz \
--cc=bsingharora@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kirill@shutemov.name \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mmarek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox