pgsql: pgindent: Keep the alignas() placeholder the same width

Started by Peter Eisentrautabout 2 months ago1 messagescommitters
Jump to latest
#1Peter Eisentraut
peter@eisentraut.org

pgindent: Keep the alignas() placeholder the same width

pre_indent() hides each alignas(...) call from pg_bsd_indent behind
a plain identifier, because pg_bsd_indent has a fixed table of
declaration keywords and lexes anything else followed by "(" as the
start of an expression.

The placeholder was not the same width as the text it stood in for,
though, and pg_bsd_indent decides where to put a trailing comment from
the width of the code preceding it. A member declared with alignas()
and carrying a trailing comment therefore got the comment separated by
a tab where the real width calls for a single space, or the other way
round. Pad the placeholder out to the original width so that the
decision is made on the real width.

No member currently declared with alignas() has a trailing comment, so
this changes nothing in the tree today; it is a correctness fix for the
helper.

Author: Tristan Partin <tristan@partin.io>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: /messages/by-id/DKBEBF32QLUA.3L2DJRPUYNKHZ@partin.io

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/305cbed95d197dfa2ea946678c0abd26113654eb

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