OK. I saw the other arguments there:
tree fntype ATTRIBUTE_UNUSED,
rtx libname ATTRIBUTE_UNUSED,
So I leverage these and add ATTRIBUTE_UNUSED to 'fndecl'
Maybe it's better remove all arguments for riscv_init_cumulative_args which are
unused as you suggested.
[email protected]
From: Jeff Law
Date: 2024-01-20 08:52
To: Juzhe-Zhong; gcc-patches
CC: pan2.li; schwab
Subject: Re: [Committed] RISC-V: Suppress warning
On 1/19/24 17:27, Juzhe-Zhong wrote:
> ../../gcc/config/riscv/riscv.cc: In function 'void
> riscv_init_cumulative_args(CUMULATIVE_ARGS*, tree, rtx, tree, int)':
> ../../gcc/config/riscv/riscv.cc:4879:34: error: unused parameter 'fndecl'
> [-Werror=unused-parameter]
> 4879 | tree fndecl,
> | ~~~~~^~~~~~
> ../../gcc/config/riscv/riscv.cc: In function 'bool
> riscv_vector_mode_supported_any_target_p(machine_mode)':
> ../../gcc/config/riscv/riscv.cc:10537:56: error: unused parameter 'mode'
> [-Werror=unused-parameter]
> 10537 | riscv_vector_mode_supported_any_target_p (machine_mode mode)
> | ~~~~~~~~~~~~~^~~~
> cc1plus: all warnings being treated as errors
> make[3]: *** [Makefile:2559: riscv.o] Error 1
>
> Suppress these warnings.
>
> gcc/ChangeLog:
>
> * config/riscv/riscv.cc (riscv_init_cumulative_args): Suppress warning.
> (riscv_vector_mode_supported_any_target_p): Ditto.
There's actually more cleanup to do in there ;-) One of the arguments
currently marked as unused is actually used. And the better way to
handle unused arguments is to just drop their name (like you did with
riscv_vector_mode_supported_any_target_p).
I'm actually in the process of bootstrapping and regression testing the
additional fixes to riscv_init_cumulative_args.
jeff