Re: log_heap_visible(): remove unused parameter and update comment

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: log_heap_visible(): remove unused parameter and update comment
Date: 2022-09-30 14:09:36
Message-ID: CALj2ACW1WjpKC2wd8PopBGOnSXo6rgNTyXMoa=kpUPB5VQdQ+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 30, 2022 at 7:30 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>
> When I try to use -Wunused-parameter, I find there are many warnings :-( .

Great!

I think we can't just remove every unused parameter, for instance, it
makes sense to retain PlannerInfo *root parameter even though it's not
used now, in future it may be. But if the parameter is of type
unrelated to the context of the function, like the one committed
65b158ae4e892c2da7a5e31e2d2645e5e79a0bfd and like the proposed patch
to some extent, it could be removed.

Others may have different thoughts here.

> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/geqo/geqo_pool.c: In function ‘free_chromo’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/geqo/geqo_pool.c:176:26: warning: unused parameter ‘root’ [-Wunused-parameter]
> 176 | free_chromo(PlannerInfo *root, Chromosome *chromo)
> | ~~~~~~~~~~~~~^~~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/equivclass.c: In function ‘eclass_useful_for_merging’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/equivclass.c:3091:40: warning: unused parameter ‘root’ [-Wunused-parameter]
> 3091 | eclass_useful_for_merging(PlannerInfo *root,
> | ~~~~~~~~~~~~~^~~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/indxpath.c: In function ‘ec_member_matches_indexcol’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/indxpath.c:3453:41: warning: unused parameter ‘root’ [-Wunused-parameter]
> 3453 | ec_member_matches_indexcol(PlannerInfo *root, RelOptInfo *rel,
> | ~~~~~~~~~~~~~^~~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/indxpath.c:3453:59: warning: unused parameter ‘rel’ [-Wunused-parameter]
> 3453 | ec_member_matches_indexcol(PlannerInfo *root, RelOptInfo *rel,
> | ~~~~~~~~~~~~^~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/indxpath.c: In function ‘relation_has_unique_index_for’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/indxpath.c:3511:44: warning: unused parameter ‘root’ [-Wunused-parameter]
> 3511 | relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel,
> | ~~~~~~~~~~~~~^~~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/joinpath.c: In function ‘allow_star_schema_join’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/joinpath.c:356:37: warning: unused parameter ‘root’ [-Wunused-parameter]
> 356 | allow_star_schema_join(PlannerInfo *root,
> | ~~~~~~~~~~~~~^~~~
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/joinpath.c: In function ‘paraminfo_get_equal_hashops’:
> /home/japin/Codes/postgres/Debug/../src/backend/optimizer/path/joinpath.c:378:42: warning: unused parameter ‘root’ [-Wunused-parameter]
> 378 | paraminfo_get_equal_hashops(PlannerInfo *root, ParamPathInfo *param_info,
> | ~~~~~~~~~~~~~^~~~

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2022-09-30 14:18:17 Re: log_heap_visible(): remove unused parameter and update comment
Previous Message Japin Li 2022-09-30 13:59:55 Re: log_heap_visible(): remove unused parameter and update comment