static assert cleanup

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-12-09T07:46:58Z
Lists: pgsql-hackers

Attachments

A number of static assertions could be moved to better places.

We first added StaticAssertStmt() in 2012, which required all static 
assertions to be inside function bodies.  We then added 
StaticAssertDecl() in 2020, which enabled static assertions on file 
level.  We have a number of calls that were stuck in not-really-related 
functions for this historical reason.  This patch set cleans that up.

0001-Update-static-assert-usage-comment.patch

This updates the usage information in c.h to be more current and precise.

0002-Move-array-size-related-static-assertions.patch

This moves some obviously poorly placed ones.

0003-Move-some-static-assertions-to-better-places.patch

This moves some that I thought were suboptimally placed but it could be 
debated or refined.

0004-Use-StaticAssertDecl-where-possible.patch

This just changes some StaticAssertStmt() to StaticAssertDecl() where 
appropriate.  It's optional.

Commits

  1. Static assertions cleanup

  2. Rearrange some static assertions for consistency