Thread: pgsql: Static assertions cleanup

pgsql: Static assertions cleanup

From
Peter Eisentraut
Date:
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(-)