postgrespro / pg_pathman

Partitioning tool for PostgreSQL
Other
584 stars 69 forks source link

Fix compiler warnings due to new checks in PostgreSQL 16 #257

Closed MarinaPolyakova closed 1 year ago

MarinaPolyakova commented 1 year ago

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;
      |                     ^~~~
codecov[bot] commented 1 year ago

Codecov Report

Merging #257 (793d719) into master (4e8efb7) will decrease coverage by 0.15%. The diff coverage is 75.00%.

:exclamation: Current head 793d719 differs from pull request most recent head 12594a3. Consider uploading reports for the commit 12594a3 to get more accurate results

@@            Coverage Diff             @@
##           master     #257      +/-   ##
==========================================
- Coverage   92.20%   92.04%   -0.16%     
==========================================
  Files          30       29       -1     
  Lines        7028     6628     -400     
==========================================
- Hits         6480     6101     -379     
+ Misses        548      527      -21     
Impacted Files Coverage Δ
src/relation_info.c 94.26% <ø> (-0.12%) :arrow_down:
src/runtime_merge_append.c 69.16% <50.00%> (-0.44%) :arrow_down:
src/partition_creation.c 96.80% <100.00%> (-0.16%) :arrow_down:
src/utils.c 90.13% <0.00%> (-2.64%) :arrow_down:
src/pg_pathman.c 93.50% <0.00%> (-1.59%) :arrow_down:
src/nodes_common.c 95.54% <0.00%> (-0.65%) :arrow_down:
src/init.c 91.04% <0.00%> (-0.27%) :arrow_down:
src/compat/pg_compat.c 77.77% <0.00%> (-0.25%) :arrow_down:
src/partition_filter.c 96.54% <0.00%> (-0.18%) :arrow_down:
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.