1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Write pg_attribute_counted_by() in front of the type

This is technically the more correct position according to C23,
although in practice compilers are relaxed about this.  It also opens
us up to supporting MSVC's _Field_size_() in the future, which is a
similar construct.

This requires adding pg_attribute_counted_by to the list of
declaration attributes in pgindent, so that pgindent doesn't mess it
up.

Author: Tristan Partin <tristan@partin.io>
Discussion: https://www.postgresql.org/message-id/flat/DKBEBF32QLUA.3L2DJRPUYNKHZ%40partin.io
This commit is contained in:
Peter Eisentraut
2026-10-02 13:00:31 +02:00
parent 5a5e3b88de
commit 6f3bdadaad
2 changed files with 2 additions and 1 deletions

View File

@@ -233,7 +233,7 @@ struct RecordIOData
Oid record_type;
int32 record_typmod;
int ncolumns;
ColumnIOData columns[FLEXIBLE_ARRAY_MEMBER] pg_attribute_counted_by(ncolumns);
pg_attribute_counted_by(ncolumns) ColumnIOData columns[FLEXIBLE_ARRAY_MEMBER];
};
/* per-query cache for populate_record_worker and populate_recordset_worker */

View File

@@ -238,6 +238,7 @@ sub write_source
# Declaration attributes that pg_bsd_indent doesn't know how to handle.
my @declaration_attributes = qw(
alignas
pg_attribute_counted_by
);
# Text of each declaration attribute, stashed by pre_indent() and restored