mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Add declaration-level assertions for compile-time checks
Those new assertions can be used at file scope, outside of any function for compilation checks. This commit provides implementations for C and C++, and fallback implementations. Author: Peter Smith Reviewed-by: Andres Freund, Kyotaro Horiguchi, Dagfinn Ilmari Mannsåker, Michael Paquier Discussion: https://postgr.es/m/201DD0641B056142AC8C6645EC1B5F62014B8E8030@SYD1217
This commit is contained in:
@ -36,6 +36,9 @@ const char *const LockTagTypeNames[] = {
|
||||
"advisory"
|
||||
};
|
||||
|
||||
StaticAssertDecl(lengthof(LockTagTypeNames) == (LOCKTAG_ADVISORY + 1),
|
||||
"array length mismatch");
|
||||
|
||||
/* This must match enum PredicateLockTargetType (predicate_internals.h) */
|
||||
static const char *const PredicateLockTagTypeNames[] = {
|
||||
"relation",
|
||||
@ -43,6 +46,9 @@ static const char *const PredicateLockTagTypeNames[] = {
|
||||
"tuple"
|
||||
};
|
||||
|
||||
StaticAssertDecl(lengthof(PredicateLockTagTypeNames) == (PREDLOCKTAG_TUPLE + 1),
|
||||
"array length mismatch");
|
||||
|
||||
/* Working status for pg_lock_status */
|
||||
typedef struct
|
||||
{
|
||||
|
Reference in New Issue
Block a user