lkml.org 
[lkml]   [2021]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2] perf tools: Fix arm64 build error with gcc-11
Date
...
> > @@ -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)
\
 
 \ /
  Last update: 2021-02-10 16:24    [W:0.080 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site