mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
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
This commit is contained in:
@ -496,7 +496,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
|
||||
&&CASE_EEOP_LAST
|
||||
};
|
||||
|
||||
StaticAssertStmt(lengthof(dispatch_table) == EEOP_LAST + 1,
|
||||
StaticAssertDecl(lengthof(dispatch_table) == EEOP_LAST + 1,
|
||||
"dispatch_table out of whack with ExprEvalOp");
|
||||
|
||||
if (unlikely(state == NULL))
|
||||
|
Reference in New Issue
Block a user