From 12594a31a25f3ca34d7b1331889c740870bff765 Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Mon, 21 Nov 2022 15:44:24 +0300 Subject: [PATCH] Fix compiler warnings due to new checks in PostgreSQL 16 See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add -Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16. --- src/partition_creation.c | 6 ++---- src/relation_info.c | 18 +++++++++--------- src/runtime_merge_append.c | 6 ++++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/partition_creation.c b/src/partition_creation.c index b98163d7..b42372b3 100644 --- a/src/partition_creation.c +++ b/src/partition_creation.c @@ -2027,11 +2027,9 @@ build_partitioning_expression(Oid parent_relid, /* We need expression type for hash functions */ if (expr_type) { - Node *expr; - expr = cook_partitioning_expression(parent_relid, expr_cstr, NULL); - /* Finally return expression type */ - *expr_type = exprType(expr); + *expr_type = exprType( + cook_partitioning_expression(parent_relid, expr_cstr, NULL)); } if (columns) diff --git a/src/relation_info.c b/src/relation_info.c index 64c04c2f..90e30d0e 100644 --- a/src/relation_info.c +++ b/src/relation_info.c @@ -71,34 +71,34 @@ int prel_resowner_line = 0; #define LeakTrackerAdd(prel) \ do { \ - MemoryContext old_mcxt = MemoryContextSwitchTo((prel)->mcxt); \ + MemoryContext leak_tracker_add_old_mcxt = MemoryContextSwitchTo((prel)->mcxt); \ (prel)->owners = \ list_append_unique( \ (prel)->owners, \ list_make2(makeString((char *) prel_resowner_function), \ makeInteger(prel_resowner_line))); \ - MemoryContextSwitchTo(old_mcxt); \ + MemoryContextSwitchTo(leak_tracker_add_old_mcxt); \ \ (prel)->access_total++; \ } while (0) #define LeakTrackerPrint(prel) \ do { \ - ListCell *lc; \ - foreach (lc, (prel)->owners) \ + ListCell *leak_tracker_print_lc; \ + foreach (leak_tracker_print_lc, (prel)->owners) \ { \ - char *fun = strVal(linitial(lfirst(lc))); \ - int line = intVal(lsecond(lfirst(lc))); \ + char *fun = strVal(linitial(lfirst(leak_tracker_print_lc))); \ + int line = intVal(lsecond(lfirst(leak_tracker_print_lc))); \ elog(WARNING, "PartRelationInfo referenced in %s:%d", fun, line); \ } \ } while (0) #define LeakTrackerFree(prel) \ do { \ - ListCell *lc; \ - foreach (lc, (prel)->owners) \ + ListCell *leak_tracker_free_lc; \ + foreach (leak_tracker_free_lc, (prel)->owners) \ { \ - list_free_deep(lfirst(lc)); \ + list_free_deep(lfirst(leak_tracker_free_lc)); \ } \ list_free((prel)->owners); \ (prel)->owners = NIL; \ diff --git a/src/runtime_merge_append.c b/src/runtime_merge_append.c index 601c663f..5edd803c 100644 --- a/src/runtime_merge_append.c +++ b/src/runtime_merge_append.c @@ -374,7 +374,8 @@ fetch_next_tuple(CustomScanState *node) for (i = 0; i < scan_state->rstate.ncur_plans; i++) { ChildScanCommon child = scan_state->rstate.cur_plans[i]; - PlanState *ps = child->content.plan_state; + + ps = child->content.plan_state; Assert(child->content_type == CHILD_PLAN_STATE); @@ -721,10 +722,11 @@ prepare_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys, foreach(j, ec->ec_members) { - EquivalenceMember *em = (EquivalenceMember *) lfirst(j); List *exprvars; ListCell *k; + em = (EquivalenceMember *) lfirst(j); + /* * We shouldn't be trying to sort by an equivalence class that * contains a constant, so no need to consider such cases any