[PATCH] score/arm: style fixes

Gedare Bloom gedare at rtems.org
Wed Jul 26 15:08:22 UTC 2023


On Tue, Jul 25, 2023 at 11:11 PM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> On 25.07.23 23:38, Gedare Bloom wrote:
> > diff --git a/cpukit/score/cpu/arm/aarch32-psma-init.c b/cpukit/score/cpu/arm/aarch32-psma-init.c
> > index 93a3673a98..b30cb5e308 100644
> > --- a/cpukit/score/cpu/arm/aarch32-psma-init.c
> > +++ b/cpukit/score/cpu/arm/aarch32-psma-init.c
> > @@ -46,7 +46,7 @@
> >   #include <rtems/score/cpu.h>
> >
> >   #define AARCH32_PMSA_REGION_MAX \
> > -  ( ( AARCH32_MPUIR_REGION_MASK >> AARCH32_MPUIR_REGION_SHIFT ) + 1 )
> > +  ((AARCH32_MPUIR_REGION_MASK >> AARCH32_MPUIR_REGION_SHIFT) + 1)
> >
> >   static void _AArch32_PMSA_Configure(
> >     const AArch32_PMSA_Region *regions,
> > @@ -57,36 +57,36 @@ static void _AArch32_PMSA_Configure(
> >     size_t   ri;
> >     uint32_t sctlr;
> >
> > -  for ( ri = 0 ; ri < region_used; ++ri ) {
> > +  for ( ri = 0; ri < region_used; ++ri ) {
> >       uint32_t prbar;
> >       uint32_t prlar;
> >       uint32_t attr;
> >
> > -    prbar = regions[ ri ].base;
> > -    prlar = regions[ ri ].limit;
> > -    attr = regions[ ri ].attributes;
> > +    prbar = regions[ri].base;
> > +    prlar = regions[ri].limit;
> > +    attr  = regions[ri].attributes;
> >
> > -    prbar |= ( attr >> 6 ) & 0x3fU;
> > +    prbar |= (attr >> 6) & 0x3fU;
> >       prlar |= attr & 0x3fU;
> >
> > -    _AArch32_Write_prselr( ri );
> > +    _AArch32_Write_prselr(ri);
> >       _ARM_Instruction_synchronization_barrier();
> > -    _AArch32_Write_prbar( prbar );
> > -    _AArch32_Write_prlar( prlar );
> > +    _AArch32_Write_prbar(prbar);
> > +    _AArch32_Write_prlar(prlar);
> >     }
>
> The existing style had the spaces which are removed here. I think this
> would lead to a lot of changes in score.
>

Yes, that is a great point. There was a brief discussion about this on
discord, and which spaces to have or not. With time, I can probably
get this handled on a case-by-case basis as needed. For example, if we
want to keep spaces inside of function arguments.

One of the examples we discussed is:
- _IO_Printf( _CPU_Put_char, &sctx, "%d", (value & mask ? 1 : 0) );
+ _IO_Printf( _CPU_Put_char, &sctx, "%d", ( value & mask ? 1 : 0 ) );

I think it should be relatively easy to add support in clang-format
for spaces that retains the original version. I'll have to sit on this
a bit longer probably to get it done.

> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber at embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list