From 6b06890f74a0003abc33aabf130825ffe3eeb694 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 18 Nov 2025 08:43:13 +0100 Subject: [PATCH 1/6] Rename AssertVariableIsOfType to StaticAssertVariableIsOfType This keeps run-time assertions and static assertions clearly separate. --- contrib/hstore_plperl/hstore_plperl.c | 12 +++---- contrib/hstore_plpython/hstore_plpython.c | 16 +++++----- contrib/jsonb_plpython/jsonb_plpython.c | 8 ++--- contrib/ltree_plpython/ltree_plpython.c | 4 +-- src/backend/executor/execParallel.c | 2 +- src/backend/jit/llvm/llvmjit_types.c | 10 +++--- src/bin/pg_upgrade/check.c | 26 ++++++++-------- src/bin/pg_upgrade/function.c | 2 +- src/bin/pg_upgrade/info.c | 6 ++-- src/bin/pg_upgrade/version.c | 2 +- src/include/access/xlogdefs.h | 2 +- src/include/c.h | 14 ++++----- src/include/lib/ilist.h | 38 +++++++++++------------ src/include/lib/pairingheap.h | 8 ++--- src/include/postgres.h | 4 +-- src/include/storage/proclist.h | 4 +-- src/include/utils/freepage.h | 2 +- src/include/utils/relptr.h | 10 +++--- 18 files changed, 85 insertions(+), 85 deletions(-) diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c index 31393b4fa50..1380a1b4367 100644 --- a/contrib/hstore_plperl/hstore_plperl.c +++ b/contrib/hstore_plperl/hstore_plperl.c @@ -28,24 +28,24 @@ static hstoreCheckValLen_t hstoreCheckValLen_p; void _PG_init(void) { - /* Asserts verify that typedefs above match original declarations */ - AssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t); + /* Static asserts verify that typedefs above match original declarations */ + StaticAssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t); hstoreUpgrade_p = (hstoreUpgrade_t) load_external_function("$libdir/hstore", "hstoreUpgrade", true, NULL); - AssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t); + StaticAssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t); hstoreUniquePairs_p = (hstoreUniquePairs_t) load_external_function("$libdir/hstore", "hstoreUniquePairs", true, NULL); - AssertVariableIsOfType(&hstorePairs, hstorePairs_t); + StaticAssertVariableIsOfType(&hstorePairs, hstorePairs_t); hstorePairs_p = (hstorePairs_t) load_external_function("$libdir/hstore", "hstorePairs", true, NULL); - AssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t); + StaticAssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t); hstoreCheckKeyLen_p = (hstoreCheckKeyLen_t) load_external_function("$libdir/hstore", "hstoreCheckKeyLen", true, NULL); - AssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t); + StaticAssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t); hstoreCheckValLen_p = (hstoreCheckValLen_t) load_external_function("$libdir/hstore", "hstoreCheckValLen", true, NULL); diff --git a/contrib/hstore_plpython/hstore_plpython.c b/contrib/hstore_plpython/hstore_plpython.c index e2bfc6da38e..3c8ada2a0dc 100644 --- a/contrib/hstore_plpython/hstore_plpython.c +++ b/contrib/hstore_plpython/hstore_plpython.c @@ -35,32 +35,32 @@ static hstoreCheckValLen_t hstoreCheckValLen_p; void _PG_init(void) { - /* Asserts verify that typedefs above match original declarations */ - AssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t); + /* Static asserts verify that typedefs above match original declarations */ + StaticAssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t); PLyObject_AsString_p = (PLyObject_AsString_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyObject_AsString", true, NULL); - AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); + StaticAssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize", true, NULL); - AssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t); + StaticAssertVariableIsOfType(&hstoreUpgrade, hstoreUpgrade_t); hstoreUpgrade_p = (hstoreUpgrade_t) load_external_function("$libdir/hstore", "hstoreUpgrade", true, NULL); - AssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t); + StaticAssertVariableIsOfType(&hstoreUniquePairs, hstoreUniquePairs_t); hstoreUniquePairs_p = (hstoreUniquePairs_t) load_external_function("$libdir/hstore", "hstoreUniquePairs", true, NULL); - AssertVariableIsOfType(&hstorePairs, hstorePairs_t); + StaticAssertVariableIsOfType(&hstorePairs, hstorePairs_t); hstorePairs_p = (hstorePairs_t) load_external_function("$libdir/hstore", "hstorePairs", true, NULL); - AssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t); + StaticAssertVariableIsOfType(&hstoreCheckKeyLen, hstoreCheckKeyLen_t); hstoreCheckKeyLen_p = (hstoreCheckKeyLen_t) load_external_function("$libdir/hstore", "hstoreCheckKeyLen", true, NULL); - AssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t); + StaticAssertVariableIsOfType(&hstoreCheckValLen, hstoreCheckValLen_t); hstoreCheckValLen_p = (hstoreCheckValLen_t) load_external_function("$libdir/hstore", "hstoreCheckValLen", true, NULL); diff --git a/contrib/jsonb_plpython/jsonb_plpython.c b/contrib/jsonb_plpython/jsonb_plpython.c index 9383615abbf..5e6d62e5518 100644 --- a/contrib/jsonb_plpython/jsonb_plpython.c +++ b/contrib/jsonb_plpython/jsonb_plpython.c @@ -39,16 +39,16 @@ static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p; void _PG_init(void) { - /* Asserts verify that typedefs above match original declarations */ - AssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t); + /* Static asserts verify that typedefs above match original declarations */ + StaticAssertVariableIsOfType(&PLyObject_AsString, PLyObject_AsString_t); PLyObject_AsString_p = (PLyObject_AsString_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyObject_AsString", true, NULL); - AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); + StaticAssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize", true, NULL); - AssertVariableIsOfType(&PLy_elog_impl, PLy_elog_impl_t); + StaticAssertVariableIsOfType(&PLy_elog_impl, PLy_elog_impl_t); PLy_elog_impl_p = (PLy_elog_impl_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLy_elog_impl", true, NULL); diff --git a/contrib/ltree_plpython/ltree_plpython.c b/contrib/ltree_plpython/ltree_plpython.c index 0493aeb2423..a25fb5c5fa5 100644 --- a/contrib/ltree_plpython/ltree_plpython.c +++ b/contrib/ltree_plpython/ltree_plpython.c @@ -20,8 +20,8 @@ static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p; void _PG_init(void) { - /* Asserts verify that typedefs above match original declarations */ - AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); + /* Static asserts verify that typedefs above match original declarations */ + StaticAssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t); PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t) load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize", true, NULL); diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index f098a5557cf..d4c622ca183 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -105,7 +105,7 @@ struct SharedExecutorInstrumentation /* array of num_plan_nodes * num_workers Instrumentation objects follows */ }; #define GetInstrumentationArray(sei) \ - (AssertVariableIsOfTypeMacro(sei, SharedExecutorInstrumentation *), \ + (StaticAssertVariableIsOfTypeMacro(sei, SharedExecutorInstrumentation *), \ (Instrumentation *) (((char *) sei) + sei->instrument_offset)) /* Context object for ExecParallelEstimate. */ diff --git a/src/backend/jit/llvm/llvmjit_types.c b/src/backend/jit/llvm/llvmjit_types.c index 167cd554b9c..053fb19f55f 100644 --- a/src/backend/jit/llvm/llvmjit_types.c +++ b/src/backend/jit/llvm/llvmjit_types.c @@ -81,7 +81,7 @@ extern Datum AttributeTemplate(PG_FUNCTION_ARGS); Datum AttributeTemplate(PG_FUNCTION_ARGS) { - AssertVariableIsOfType(&AttributeTemplate, PGFunction); + StaticAssertVariableIsOfType(&AttributeTemplate, PGFunction); PG_RETURN_NULL(); } @@ -99,8 +99,8 @@ ExecEvalSubroutineTemplate(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext) { - AssertVariableIsOfType(&ExecEvalSubroutineTemplate, - ExecEvalSubroutine); + StaticAssertVariableIsOfType(&ExecEvalSubroutineTemplate, + ExecEvalSubroutine); } extern bool ExecEvalBoolSubroutineTemplate(ExprState *state, @@ -111,8 +111,8 @@ ExecEvalBoolSubroutineTemplate(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext) { - AssertVariableIsOfType(&ExecEvalBoolSubroutineTemplate, - ExecEvalBoolSubroutine); + StaticAssertVariableIsOfType(&ExecEvalBoolSubroutineTemplate, + ExecEvalBoolSubroutine); return false; } diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 1e17d64b3ec..7a37d54bebb 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -398,7 +398,7 @@ process_data_type_check(DbInfo *dbinfo, PGresult *res, void *arg) int i_attname = PQfnumber(res, "attname"); FILE *script = NULL; - AssertVariableIsOfType(&process_data_type_check, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_data_type_check, UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1262,8 +1262,8 @@ process_isn_and_int8_passing_mismatch(DbInfo *dbinfo, PGresult *res, void *arg) int i_proname = PQfnumber(res, "proname"); UpgradeTaskReport *report = (UpgradeTaskReport *) arg; - AssertVariableIsOfType(&process_isn_and_int8_passing_mismatch, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_isn_and_int8_passing_mismatch, + UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1351,8 +1351,8 @@ process_user_defined_postfix_ops(DbInfo *dbinfo, PGresult *res, void *arg) int i_typnsp = PQfnumber(res, "typnsp"); int i_typname = PQfnumber(res, "typname"); - AssertVariableIsOfType(&process_user_defined_postfix_ops, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_user_defined_postfix_ops, + UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1442,8 +1442,8 @@ process_incompat_polymorphics(DbInfo *dbinfo, PGresult *res, void *arg) int i_objkind = PQfnumber(res, "objkind"); int i_objname = PQfnumber(res, "objname"); - AssertVariableIsOfType(&process_incompat_polymorphics, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_incompat_polymorphics, + UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1575,7 +1575,7 @@ process_with_oids_check(DbInfo *dbinfo, PGresult *res, void *arg) int i_nspname = PQfnumber(res, "nspname"); int i_relname = PQfnumber(res, "relname"); - AssertVariableIsOfType(&process_with_oids_check, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_with_oids_check, UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1646,8 +1646,8 @@ process_inconsistent_notnull(DbInfo *dbinfo, PGresult *res, void *arg) int i_relname = PQfnumber(res, "relname"); int i_attname = PQfnumber(res, "attname"); - AssertVariableIsOfType(&process_inconsistent_notnull, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_inconsistent_notnull, + UpgradeTaskProcessCB); if (ntups == 0) return; @@ -1793,8 +1793,8 @@ process_user_defined_encoding_conversions(DbInfo *dbinfo, PGresult *res, void *a int i_conname = PQfnumber(res, "conname"); int i_nspname = PQfnumber(res, "nspname"); - AssertVariableIsOfType(&process_user_defined_encoding_conversions, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_user_defined_encoding_conversions, + UpgradeTaskProcessCB); if (ntups == 0) return; @@ -2309,7 +2309,7 @@ process_old_sub_state_check(DbInfo *dbinfo, PGresult *res, void *arg) int i_nspname = PQfnumber(res, "nspname"); int i_relname = PQfnumber(res, "relname"); - AssertVariableIsOfType(&process_old_sub_state_check, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_old_sub_state_check, UpgradeTaskProcessCB); if (ntups == 0) return; diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c index 9ad53caeebc..66982a142e1 100644 --- a/src/bin/pg_upgrade/function.c +++ b/src/bin/pg_upgrade/function.c @@ -61,7 +61,7 @@ process_loadable_libraries(DbInfo *dbinfo, PGresult *res, void *arg) { struct loadable_libraries_state *state = (struct loadable_libraries_state *) arg; - AssertVariableIsOfType(&process_loadable_libraries, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_loadable_libraries, UpgradeTaskProcessCB); state->ress[dbinfo - old_cluster.dbarr.dbs] = res; state->totaltups += PQntuples(res); diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index 7ce08270168..397682b11d5 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -601,7 +601,7 @@ process_rel_infos(DbInfo *dbinfo, PGresult *res, void *arg) char *last_namespace = NULL; char *last_tablespace = NULL; - AssertVariableIsOfType(&process_rel_infos, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_rel_infos, UpgradeTaskProcessCB); for (int relnum = 0; relnum < ntups; relnum++) { @@ -727,8 +727,8 @@ process_old_cluster_logical_slot_infos(DbInfo *dbinfo, PGresult *res, void *arg) LogicalSlotInfo *slotinfos = NULL; int num_slots = PQntuples(res); - AssertVariableIsOfType(&process_old_cluster_logical_slot_infos, - UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_old_cluster_logical_slot_infos, + UpgradeTaskProcessCB); if (num_slots) { diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c index 3ad5a991a30..c499582660e 100644 --- a/src/bin/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -152,7 +152,7 @@ process_extension_updates(DbInfo *dbinfo, PGresult *res, void *arg) UpgradeTaskReport *report = (UpgradeTaskReport *) arg; PQExpBufferData connectbuf; - AssertVariableIsOfType(&process_extension_updates, UpgradeTaskProcessCB); + StaticAssertVariableIsOfType(&process_extension_updates, UpgradeTaskProcessCB); if (ntups == 0) return; diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index 5f07e57c832..4badeca2458 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -44,7 +44,7 @@ typedef uint64 XLogRecPtr; * To avoid breaking translatable messages, we're directly applying the * LSN format instead of using a macro. */ -#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn)) +#define LSN_FORMAT_ARGS(lsn) (StaticAssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn)) /* * XLogSegNo - physical log file sequence number. diff --git a/src/include/c.h b/src/include/c.h index cb8a38669be..bea342a5de6 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -965,26 +965,26 @@ pg_noreturn extern void ExceptionalCondition(const char *conditionName, /* * Compile-time checks that a variable (or expression) has the specified type. * - * AssertVariableIsOfType() can be used as a statement. - * AssertVariableIsOfTypeMacro() is intended for use in macros, eg - * #define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x)) + * StaticAssertVariableIsOfType() can be used as a statement. + * StaticAssertVariableIsOfTypeMacro() is intended for use in macros, eg + * #define foo(x) (StaticAssertVariableIsOfTypeMacro(x, int), bar(x)) * * If we don't have __builtin_types_compatible_p, we can still assert that * the types have the same size. This is far from ideal (especially on 32-bit * platforms) but it provides at least some coverage. */ #ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P -#define AssertVariableIsOfType(varname, typename) \ +#define StaticAssertVariableIsOfType(varname, typename) \ StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \ CppAsString(varname) " does not have type " CppAsString(typename)) -#define AssertVariableIsOfTypeMacro(varname, typename) \ +#define StaticAssertVariableIsOfTypeMacro(varname, typename) \ (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \ CppAsString(varname) " does not have type " CppAsString(typename))) #else /* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */ -#define AssertVariableIsOfType(varname, typename) \ +#define StaticAssertVariableIsOfType(varname, typename) \ StaticAssertStmt(sizeof(varname) == sizeof(typename), \ CppAsString(varname) " does not have type " CppAsString(typename)) -#define AssertVariableIsOfTypeMacro(varname, typename) \ +#define StaticAssertVariableIsOfTypeMacro(varname, typename) \ (StaticAssertExpr(sizeof(varname) == sizeof(typename), \ CppAsString(varname) " does not have type " CppAsString(typename))) #endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ diff --git a/src/include/lib/ilist.h b/src/include/lib/ilist.h index 85a641eb41d..88bde08319b 100644 --- a/src/include/lib/ilist.h +++ b/src/include/lib/ilist.h @@ -591,8 +591,8 @@ dlist_tail_node(dlist_head *head) * This is used to convert a dlist_node * back to its containing struct. */ #define dlist_container(type, membername, ptr) \ - (AssertVariableIsOfTypeMacro(ptr, dlist_node *), \ - AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (StaticAssertVariableIsOfTypeMacro(ptr, dlist_node *), \ + StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ ((type *) ((char *) (ptr) - offsetof(type, membername)))) /* @@ -601,7 +601,7 @@ dlist_tail_node(dlist_head *head) * The list must not be empty. */ #define dlist_head_element(type, membername, lhead) \ - (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ (type *) dlist_head_element_off(lhead, offsetof(type, membername))) /* @@ -610,7 +610,7 @@ dlist_tail_node(dlist_head *head) * The list must not be empty. */ #define dlist_tail_element(type, membername, lhead) \ - (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ ((type *) dlist_tail_element_off(lhead, offsetof(type, membername)))) /* @@ -621,8 +621,8 @@ dlist_tail_node(dlist_head *head) * It is *not* allowed to manipulate the list during iteration. */ #define dlist_foreach(iter, lhead) \ - for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ - AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, dlist_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, dlist_head *), \ (iter).end = &(lhead)->head, \ (iter).cur = (iter).end->next ? (iter).end->next : (iter).end; \ (iter).cur != (iter).end; \ @@ -638,8 +638,8 @@ dlist_tail_node(dlist_head *head) * fine to insert or delete adjacent nodes. */ #define dlist_foreach_modify(iter, lhead) \ - for (AssertVariableIsOfTypeMacro(iter, dlist_mutable_iter), \ - AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, dlist_mutable_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, dlist_head *), \ (iter).end = &(lhead)->head, \ (iter).cur = (iter).end->next ? (iter).end->next : (iter).end, \ (iter).next = (iter).cur->next; \ @@ -652,8 +652,8 @@ dlist_tail_node(dlist_head *head) * It is *not* allowed to manipulate the list during iteration. */ #define dlist_reverse_foreach(iter, lhead) \ - for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ - AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, dlist_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, dlist_head *), \ (iter).end = &(lhead)->head, \ (iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end; \ (iter).cur != (iter).end; \ @@ -953,7 +953,7 @@ dclist_count(const dclist_head *head) * The list must not be empty. */ #define dclist_head_element(type, membername, lhead) \ - (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ (type *) dclist_head_element_off(lhead, offsetof(type, membername))) /* @@ -962,7 +962,7 @@ dclist_count(const dclist_head *head) * The list must not be empty. */ #define dclist_tail_element(type, membername, lhead) \ - (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ ((type *) dclist_tail_element_off(lhead, offsetof(type, membername)))) @@ -1104,8 +1104,8 @@ slist_delete_current(slist_mutable_iter *iter) * This is used to convert a slist_node * back to its containing struct. */ #define slist_container(type, membername, ptr) \ - (AssertVariableIsOfTypeMacro(ptr, slist_node *), \ - AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + (StaticAssertVariableIsOfTypeMacro(ptr, slist_node *), \ + StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ ((type *) ((char *) (ptr) - offsetof(type, membername)))) /* @@ -1114,7 +1114,7 @@ slist_delete_current(slist_mutable_iter *iter) * The list must not be empty. */ #define slist_head_element(type, membername, lhead) \ - (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ (type *) slist_head_element_off(lhead, offsetof(type, membername))) /* @@ -1130,8 +1130,8 @@ slist_delete_current(slist_mutable_iter *iter) * not safe.) */ #define slist_foreach(iter, lhead) \ - for (AssertVariableIsOfTypeMacro(iter, slist_iter), \ - AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, slist_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, slist_head *), \ (iter).cur = (lhead)->head.next; \ (iter).cur != NULL; \ (iter).cur = (iter).cur->next) @@ -1146,8 +1146,8 @@ slist_delete_current(slist_mutable_iter *iter) * deletion of nodes adjacent to the current node would misbehave. */ #define slist_foreach_modify(iter, lhead) \ - for (AssertVariableIsOfTypeMacro(iter, slist_mutable_iter), \ - AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, slist_mutable_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, slist_head *), \ (iter).prev = &(lhead)->head, \ (iter).cur = (iter).prev->next, \ (iter).next = (iter).cur ? (iter).cur->next : NULL; \ diff --git a/src/include/lib/pairingheap.h b/src/include/lib/pairingheap.h index 567586f2ecf..b0f4c325ba2 100644 --- a/src/include/lib/pairingheap.h +++ b/src/include/lib/pairingheap.h @@ -41,16 +41,16 @@ typedef struct pairingheap_node * This is used to convert a pairingheap_node * back to its containing struct. */ #define pairingheap_container(type, membername, ptr) \ - (AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \ - AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + (StaticAssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \ + StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ ((type *) ((char *) (ptr) - offsetof(type, membername)))) /* * Like pairingheap_container, but used when the pointer is 'const ptr' */ #define pairingheap_const_container(type, membername, ptr) \ - (AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \ - AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + (StaticAssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \ + StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ ((const type *) ((const char *) (ptr) - offsetof(type, membername)))) /* diff --git a/src/include/postgres.h b/src/include/postgres.h index 357cbd6fd96..5859844d9b8 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -513,9 +513,9 @@ Float8GetDatum(float8 X) */ #define Int64GetDatumFast(X) \ - (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X)) + (StaticAssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X)) #define Float8GetDatumFast(X) \ - (AssertVariableIsOfTypeMacro(X, double), Float8GetDatum(X)) + (StaticAssertVariableIsOfTypeMacro(X, double), Float8GetDatum(X)) /* ---------------------------------------------------------------- diff --git a/src/include/storage/proclist.h b/src/include/storage/proclist.h index a157f8df67f..c43d774f6ad 100644 --- a/src/include/storage/proclist.h +++ b/src/include/storage/proclist.h @@ -204,8 +204,8 @@ proclist_pop_head_node_offset(proclist_head *list, size_t node_offset) * node with proclist_delete(list, iter.cur, node_offset). */ #define proclist_foreach_modify(iter, lhead, link_member) \ - for (AssertVariableIsOfTypeMacro(iter, proclist_mutable_iter), \ - AssertVariableIsOfTypeMacro(lhead, proclist_head *), \ + for (StaticAssertVariableIsOfTypeMacro(iter, proclist_mutable_iter), \ + StaticAssertVariableIsOfTypeMacro(lhead, proclist_head *), \ (iter).cur = (lhead)->head, \ (iter).next = (iter).cur == INVALID_PROC_NUMBER ? INVALID_PROC_NUMBER : \ proclist_node_get((iter).cur, \ diff --git a/src/include/utils/freepage.h b/src/include/utils/freepage.h index 18643a8c35d..70127bad430 100644 --- a/src/include/utils/freepage.h +++ b/src/include/utils/freepage.h @@ -65,7 +65,7 @@ struct FreePageManager /* Macros to convert between page numbers (expressed as Size) and pointers. */ #define fpm_page_to_pointer(base, page) \ - (AssertVariableIsOfTypeMacro(page, Size), \ + (StaticAssertVariableIsOfTypeMacro(page, Size), \ (base) + FPM_PAGE_SIZE * (page)) #define fpm_pointer_to_page(base, ptr) \ (((Size) (((char *) (ptr)) - (base))) / FPM_PAGE_SIZE) diff --git a/src/include/utils/relptr.h b/src/include/utils/relptr.h index ea340fee657..3e3bdb3227f 100644 --- a/src/include/utils/relptr.h +++ b/src/include/utils/relptr.h @@ -40,7 +40,7 @@ #ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P #define relptr_access(base, rp) \ - (AssertVariableIsOfTypeMacro(base, char *), \ + (StaticAssertVariableIsOfTypeMacro(base, char *), \ (__typeof__((rp).relptr_type)) ((rp).relptr_off == 0 ? NULL : \ (base) + (rp).relptr_off - 1)) #else @@ -49,7 +49,7 @@ * __typeof__ either. */ #define relptr_access(base, rp) \ - (AssertVariableIsOfTypeMacro(base, char *), \ + (StaticAssertVariableIsOfTypeMacro(base, char *), \ (void *) ((rp).relptr_off == 0 ? NULL : (base) + (rp).relptr_off - 1)) #endif @@ -74,8 +74,8 @@ relptr_store_eval(char *base, char *val) #ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P #define relptr_store(base, rp, val) \ - (AssertVariableIsOfTypeMacro(base, char *), \ - AssertVariableIsOfTypeMacro(val, __typeof__((rp).relptr_type)), \ + (StaticAssertVariableIsOfTypeMacro(base, char *), \ + StaticAssertVariableIsOfTypeMacro(val, __typeof__((rp).relptr_type)), \ (rp).relptr_off = relptr_store_eval((base), (char *) (val))) #else /* @@ -83,7 +83,7 @@ relptr_store_eval(char *base, char *val) * __typeof__ either. */ #define relptr_store(base, rp, val) \ - (AssertVariableIsOfTypeMacro(base, char *), \ + (StaticAssertVariableIsOfTypeMacro(base, char *), \ (rp).relptr_off = relptr_store_eval((base), (char *) (val))) #endif -- 2.51.0