mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'John Garry' <john.garry@huawei.com>,
	Jianlin Lv <Jianlin.Lv@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"mathieu.poirier@linaro.org" <mathieu.poirier@linaro.org>,
	"leo.yan@linaro.org" <leo.yan@linaro.org>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"jolsa@redhat.com" <jolsa@redhat.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"irogers@google.com" <irogers@google.com>,
	"agerstmayr@redhat.com" <agerstmayr@redhat.com>,
	"kan.liang@linux.intel.com" <kan.liang@linux.intel.com>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] perf tools: Fix arm64 build error with gcc-11
Date: Wed, 10 Feb 2021 15:20:53 +0000	[thread overview]
Message-ID: <a2eb2a9066254093b50c3ed87171b902@AcuMS.aculab.com> (raw)
In-Reply-To: <5db96a5f-3749-7f54-15ce-27b932bcbca6@huawei.com>

...
> > @@ -691,6 +691,7 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size)
> >   {
> >   	unsigned int i = 0, r;
> >   	int printed = 0;
> > +	const char *reg_name;
> >
> >   	bf[0] = 0;
> >
> > @@ -700,9 +701,10 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size)
> >   	for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) {
> 
> a good practice is to limit scope of variables as much as possible, so
> reg_name could be declared here

I'd go for either function scope or a very small inner block
(like this one).

Otherwise it gets very difficult for the average human (or other
intelligent being) to locate the definition.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      parent reply	other threads:[~2021-02-10 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  3:24 Jianlin Lv
2021-02-10  9:38 ` John Garry
2021-02-10 14:40   ` Jianlin Lv
2021-02-10 15:20   ` David Laight [this message]

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=a2eb2a9066254093b50c3ed87171b902@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Jianlin.Lv@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=agerstmayr@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®