pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Static assertions cleanup
Date: Thu, 15 Dec 2022 09:21:48 +0000
Message-ID: <E1p5kR1-003gb1-MH@gemulon.postgresql.org> (raw)

Static assertions cleanup

Because we added StaticAssertStmt() first before StaticAssertDecl(),
some uses as well as the instructions in c.h are now a bit backwards
from the "native" way static assertions are meant to be used in C.
This updates the guidance and moves some static assertions to better
places.

Specifically, since the addition of StaticAssertDecl(), we can put
static assertions at the file level.  This moves a number of static
assertions out of function bodies, where they might have been stuck
out of necessity, to perhaps better places at the file level or in
header files.

Also, when the static assertion appears in a position where a
declaration is allowed, then using StaticAssertDecl() is more native
than StaticAssertStmt().

Reviewed-by: John Naylor <john.naylor@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/941a04e7-dd6f-c0e4-8cdf-a33b3338cbda%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/75f49221c22286104f032827359783aa5f4e6646

Modified Files
--------------
src/backend/access/heap/heapam.c      |  6 +-----
src/backend/access/nbtree/nbtutils.c  |  7 -------
src/backend/access/transam/clog.c     |  2 +-
src/backend/access/transam/xlog.c     |  9 ---------
src/backend/backup/basebackup.c       |  4 ++--
src/backend/catalog/dependency.c      | 12 ++++++------
src/backend/executor/execExprInterp.c |  2 +-
src/backend/libpq/auth-scram.c        |  2 +-
src/backend/libpq/hba.c               | 12 ++++++------
src/backend/port/atomics.c            |  6 +++---
src/backend/storage/lmgr/lwlock.c     |  9 +++------
src/backend/storage/page/itemptr.c    | 13 ++++++-------
src/backend/utils/adt/numeric.c       |  3 ++-
src/backend/utils/adt/tsginidx.c      |  2 --
src/backend/utils/adt/xid8funcs.c     | 15 ++++++++-------
src/backend/utils/cache/syscache.c    |  6 +++---
src/backend/utils/mmgr/aset.c         |  6 +++---
src/backend/utils/mmgr/generation.c   |  2 +-
src/backend/utils/mmgr/slab.c         |  2 +-
src/common/checksum_helper.c          | 10 +++++-----
src/common/controldata_utils.c        |  8 --------
src/common/encnames.c                 |  6 +++---
src/include/access/gin.h              |  3 +++
src/include/access/htup_details.h     |  3 +++
src/include/access/nbtree.h           |  7 +++++++
src/include/c.h                       | 33 ++++++++++++++++++---------------
src/include/catalog/pg_control.h      |  8 ++++++++
src/include/common/int128.h           |  2 +-
src/include/storage/lwlock.h          |  3 +++
29 files changed, 99 insertions(+), 104 deletions(-)



Message-ID: <E1p5kR1-003gb1-MH@gemulon.postgresql.org>
Permalink:  ../E1p5kR1-003gb1-MH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p5kR1-003gb1-MH@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Static assertions cleanup
  In-Reply-To: <E1p5kR1-003gb1-MH@gemulon.postgresql.org>
  References: <E1p5kR1-003gb1-MH@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox