Re: lwlocknames.h beautification attempt - Mailing list pgsql-hackers

From Gurjeet Singh
Subject Re: lwlocknames.h beautification attempt
Date
Msg-id CABwTF4VK4sFjdm9kE9CcWW1p2MGDBW4qhA_Sibcy=9fj+oP8bg@mail.gmail.com
Whole thread Raw
In response to Re: lwlocknames.h beautification attempt  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: lwlocknames.h beautification attempt
List pgsql-hackers
On Sat, Mar 1, 2025 at 10:26 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Gurjeet Singh <gurjeet@singh.im> writes:
> > I propose the following change to the generation script,
> > generate-lwlocknames.pl
> > ...
> > which produces the lock names in this format
>
> > #define ShmemIndexLock                 (&MainLWLockArray[1].lock)
> > #define OidGenLock                     (&MainLWLockArray[2].lock)
> > #define XidGenLock                     (&MainLWLockArray[3].lock)
> > #define ProcArrayLock                  (&MainLWLockArray[4].lock)
> > #define SInvalReadLock                 (&MainLWLockArray[5].lock)
>
> This looks reasonably in line with project style ...

Should I create a commitfest entry for this patch, or is it
uncontroversial enough and small enough to not warrant that?

> > Yet another format, which I prefer, can be achieved by right-aligning the
> > lock names.
>
> > #define                 ShmemIndexLock (&MainLWLockArray[1].lock)
> > #define                     OidGenLock (&MainLWLockArray[2].lock)
> > #define                     XidGenLock (&MainLWLockArray[3].lock)
> > #define                  ProcArrayLock (&MainLWLockArray[4].lock)
> > #define                 SInvalReadLock (&MainLWLockArray[5].lock)
>
> ... but that doesn't.  I challenge you to provide even one example
> of that layout in our source tree, or to explain why it's better.

I haven't seen this style in any other project, let alone in Postgres. I
just mentioned it since I personally liked it slightly better after
trying a couple of different styles, because of the aligned suffix in
the lock names.



Best regards,
Gurjeet
http://Gurje.et



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: lwlocknames.h beautification attempt
Next
From: Tom Lane
Date:
Subject: Re: lwlocknames.h beautification attempt