1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +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:
Michael Paquier
2020-02-03 14:48:42 +09:00
parent 6148e2b9a6
commit f1f10a1ba9
7 changed files with 76 additions and 12 deletions

View File

@ -37,6 +37,9 @@ const char *const forkNames[] = {
"init" /* INIT_FORKNUM */
};
StaticAssertDecl(lengthof(forkNames) == (MAX_FORKNUM + 1),
"array length mismatch");
/*
* forkname_to_number - look up fork number by name
*