See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add -Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16.
src/relation_info.c: In function ‘resowner_prel_add’:src/relation_info.c:74:31: warning: declaration of ‘old_mcxt’ shadows a previous local [-Wshadow=compatible-local] 74 | MemoryContext old_mcxt = MemoryContextSwitchTo((prel)->mcxt); \ | ^~~~~~~~src/relation_info.c:608:17: note: in expansion of macro ‘LeakTrackerAdd’ 608 | LeakTrackerAdd(prel); | ^~~~~~~~~~~~~~src/relation_info.c:592:41: note: shadowed declaration is here 592 | MemoryContext old_mcxt; | ^~~~~~~~src/relation_info.c: In function ‘resonwner_prel_callback’:src/relation_info.c:87:27: warning: declaration of ‘lc’ shadows a previous local [-Wshadow=compatible-local] 87 | ListCell *lc; \ | ^~src/relation_info.c:691:41: note: in expansion of macro ‘LeakTrackerPrint’ 691 | LeakTrackerPrint(prel); | ^~~~~~~~~~~~~~~~src/relation_info.c:675:27: note: shadowed declaration is here 675 | ListCell *lc; | ^~In file included from /home/marina/postgresql/postgresql/my/inst/include/server/access/tupdesc.h:19, from /home/marina/pg_pathman/src/include/compat/pg_compat.h:25, from src/relation_info.c:11:src/relation_info.c:88:26: warning: declaration of ‘lc__state’ shadows a previous local [-Wshadow=compatible-local] 88 | foreach (lc, (prel)->owners) \ | ^~/home/marina/postgresql/postgresql/my/inst/include/server/nodes/pg_list.h:372:27: note: in definition of macro ‘foreach’ 372 | for (ForEachState cell##__state = {(lst), 0}; \ | ^~~~src/relation_info.c:691:41: note: in expansion of macro ‘LeakTrackerPrint’ 691 | LeakTrackerPrint(prel); | ^~~~~~~~~~~~~~~~src/relation_info.c:684:34: note: shadowed declaration is here 684 | foreach (lc, info->prels) | ^~/home/marina/postgresql/postgresql/my/inst/include/server/nodes/pg_list.h:372:27: note: in definition of macro ‘foreach’ 372 | for (ForEachState cell##__state = {(lst), 0}; \ | ^~~~src/relation_info.c:98:27: warning: declaration of ‘lc’ shadows a previous local [-Wshadow=compatible-local] 98 | ListCell *lc; \ | ^~src/relation_info.c:705:33: note: in expansion of macro ‘LeakTrackerFree’ 705 | LeakTrackerFree(prel); | ^~~~~~~~~~~~~~~src/relation_info.c:675:27: note: shadowed declaration is here 675 | ListCell *lc; | ^~In file included from /home/marina/postgresql/postgresql/my/inst/include/server/access/tupdesc.h:19, from /home/marina/pg_pathman/src/include/compat/pg_compat.h:25, from src/relation_info.c:11:src/relation_info.c:99:26: warning: declaration of ‘lc__state’ shadows a previous local [-Wshadow=compatible-local] 99 | foreach (lc, (prel)->owners) \ | ^~/home/marina/postgresql/postgresql/my/inst/include/server/nodes/pg_list.h:372:27: note: in definition of macro ‘foreach’ 372 | for (ForEachState cell##__state = {(lst), 0}; \ | ^~~~src/relation_info.c:705:33: note: in expansion of macro ‘LeakTrackerFree’ 705 | LeakTrackerFree(prel); | ^~~~~~~~~~~~~~~src/relation_info.c:684:34: note: shadowed declaration is here 684 | foreach (lc, info->prels) | ^~/home/marina/postgresql/postgresql/my/inst/include/server/nodes/pg_list.h:372:27: note: in definition of macro ‘foreach’ 372 | for (ForEachState cell##__state = {(lst), 0}; \ | ^~~~src/runtime_merge_append.c: In function ‘fetch_next_tuple’:src/runtime_merge_append.c:377:53: warning: declaration of ‘ps’ shadows a previous local [-Wshadow=compatible-local] 377 | PlanState *ps = child->content.plan_state; | ^~src/runtime_merge_append.c:369:53: note: shadowed declaration is here 369 | PlanState *ps; | ^~src/runtime_merge_append.c: In function ‘prepare_sort_from_pathkeys’:src/runtime_merge_append.c:724:52: warning: declaration of ‘em’ shadows a previous local [-Wshadow=compatible-local] 724 | EquivalenceMember *em = (EquivalenceMember *) lfirst(j); | ^~src/runtime_merge_append.c:635:36: note: shadowed declaration is here 635 | EquivalenceMember *em; | ^~src/partition_creation.c: In function ‘build_partitioning_expression’:src/partition_creation.c:2030:26: warning: declaration of ‘expr’ shadows a previous local [-Wshadow=compatible-local] 2030 | Node *expr; | ^~~~src/partition_creation.c:2017:21: note: shadowed declaration is here 2017 | Node *expr; | ^~~~
See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add -Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16.