pgsql: pgindent: Fix indentation of alignas() in struct members

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgindent: Fix indentation of alignas() in struct members
Date: 2026-09-16 07:14:35
Message-ID: E1x6jql-00000000Y89-3DTp@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pgindent: Fix indentation of alignas() in struct members

pg_bsd_indent doesn't know about alignas(), so a struct member
declared with it is misindented unless it's the first member.

Disguise each alignas(...) call as a plain identifier while
indenting, restoring it afterward. Stash the call's original text
by index rather than embedding it in the placeholder: embedding only
works for a single-token argument, and fails to match at all against
nested parens (e.g. alignas(sizeof(x))) or a line break, silently
skipping the disguise.

There is currently no code affected by this, but there are some
pending patches that would be.

Co-authored-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Co-authored-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Discussion: https://postgr.es/m/94a128da-bf3e-46bd-9e2d-609573c484da@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/884f82ae2621cc8d983bb745ce6c8c1c9a971764

Modified Files
--------------
src/tools/pgindent/pgindent | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-09-16 07:56:08 pgsql: doc: Fix primary status update WAL position description
Previous Message Michael Paquier 2026-09-16 01:57:53 pgsql: pg_upgrade: Run test suite with initial OID higher than UINT32_M