linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH] tools/perf: Do not set a variable unless it will be used
Date: Fri, 4 Jun 2021 21:24:23 +0200	[thread overview]
Message-ID: <CANiDSCu4Brz7FZX5oa57kNLG9h_1EASX=bdQij4+apg0ZwW8QA@mail.gmail.com> (raw)
In-Reply-To: <YLn0D+1R2QHZYRVV@hirez.programming.kicks-ass.net>

Hi Peter

On Fri, 4 Jun 2021 at 11:36, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Fri, Jun 04, 2021 at 11:26:38AM +0200, Ricardo Ribalda wrote:
> > clang-13 triggers the following warning:
> >
> > bench/inject-buildid.c:351:6: error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
> >         u64 len = 0;
> >
> > This patch sets the value to len only if it will be used afterwards.
>
> My vote would be to kill that warning, what absolute shite.

My knowledge of llvm codebase is close to NULL, so it is much easier
for me to "fix" the code.

I would assume that the static analyser has found a magic condition
where the previous if always returns false, and has managed to
"optimize" the code.





-- 
Ricardo Ribalda

  reply	other threads:[~2021-06-04 19:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04  9:26 [PATCH] tools/perf: Do not set a variable unless it will be used Ricardo Ribalda
2021-06-04  9:36 ` Peter Zijlstra
2021-06-04 19:24   ` Ricardo Ribalda [this message]
2021-06-08 11:28     ` Peter Zijlstra
2021-06-09 14:15       ` Ricardo Ribalda
2021-06-08 11:12   ` David Laight

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='CANiDSCu4Brz7FZX5oa57kNLG9h_1EASX=bdQij4+apg0ZwW8QA@mail.gmail.com' \
    --to=ribalda@chromium.org \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).