Re: log_heap_visible(): remove unused parameter and update comment - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: log_heap_visible(): remove unused parameter and update comment
Date
Msg-id CALj2ACW1WjpKC2wd8PopBGOnSXo6rgNTyXMoa=kpUPB5VQdQ+g@mail.gmail.com
Whole thread Raw
In response to Re: log_heap_visible(): remove unused parameter and update comment  (Japin Li <japinli@hotmail.com>)
Responses Re: log_heap_visible(): remove unused parameter and update comment
List pgsql-hackers
On Fri, Sep 30, 2022 at 7:30 PM Japin Li <japinli@hotmail.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



pgsql-hackers by date:

Previous
From: Japin Li
Date:
Subject: Re: log_heap_visible(): remove unused parameter and update comment
Next
From: Japin Li
Date:
Subject: Re: log_heap_visible(): remove unused parameter and update comment