[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a2eb2a9066254093b50c3ed87171b902@AcuMS.aculab.com>
Date: Wed, 10 Feb 2021 15:20:53 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'John Garry' <john.garry@...wei.com>,
Jianlin Lv <Jianlin.Lv@....com>,
"will@...nel.org" <will@...nel.org>,
"mathieu.poirier@...aro.org" <mathieu.poirier@...aro.org>,
"leo.yan@...aro.org" <leo.yan@...aro.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"acme@...nel.org" <acme@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com"
<alexander.shishkin@...ux.intel.com>,
"jolsa@...hat.com" <jolsa@...hat.com>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"irogers@...gle.com" <irogers@...gle.com>,
"agerstmayr@...hat.com" <agerstmayr@...hat.com>,
"kan.liang@...ux.intel.com" <kan.liang@...ux.intel.com>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] perf tools: Fix arm64 build error with gcc-11
...
> > @@ -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)
Powered by blists - more mailing lists