Re: [PATCH 2/2] RISC-V: Implement TARGET_COMPUTE_MULTILIB

2022-09-09 Thread Kito Cheng via Gcc-patches
Hi Andreas:

Hm, I should change my default gcc on Ubuntu, I didn't got this
when build with GCC 7, and can be reproduced by GCC 11,

Will summit patch once I test done.

On Fri, Sep 9, 2022 at 3:21 PM Andreas Schwab  wrote:
>
> How did you test that?
>
> ../../gcc/common/config/riscv/riscv-common.cc: In function 'const char* 
> riscv_multi_lib_check(int, const char**)':
> ../../gcc/common/config/riscv/riscv-common.cc:1451:11: error: bare apostrophe 
> ''' in format [-Werror=format-diag]
>  1451 |   "Can't find suitable multilib set for 
> %<-march=%s%>/%<-mabi=%s%>",
>   |   ^
> ../../gcc/common/config/riscv/riscv-common.cc:1451:7: note: if avoiding the 
> apostrophe is not feasible, enclose it in a pair of '%<' and '%>' directives 
> instead
>  1451 |   "Can't find suitable multilib set for 
> %<-march=%s%>/%<-mabi=%s%>",
>   |   
> ^
> ../../gcc/common/config/riscv/riscv-common.cc: At global scope:
> ../../gcc/common/config/riscv/riscv-common.cc:1492:1: error: 'int 
> riscv_check_conds(const switchstr*, int, int, const 
> std::vector >&)' defined but not used 
> [-Werror=unused-function]
>  1492 | riscv_check_conds (
>   | ^
> ../../gcc/common/config/riscv/riscv-common.cc:1374:1: error: 'const char* 
> find_last_appear_switch(const switchstr*, int, const char*)' defined but not 
> used [-Werror=unused-function]
>  1374 | find_last_appear_switch (
>   | ^~~
> cc1plus: all warnings being treated as errors
> make[3]: *** [Makefile:2442: riscv-common.o] Error 1
>
> --
> Andreas Schwab, sch...@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."


Re: [PATCH 2/2] RISC-V: Implement TARGET_COMPUTE_MULTILIB

2022-09-09 Thread Andreas Schwab
How did you test that?

../../gcc/common/config/riscv/riscv-common.cc: In function 'const char* 
riscv_multi_lib_check(int, const char**)':
../../gcc/common/config/riscv/riscv-common.cc:1451:11: error: bare apostrophe 
''' in format [-Werror=format-diag]
 1451 |   "Can't find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>",
  |   ^
../../gcc/common/config/riscv/riscv-common.cc:1451:7: note: if avoiding the 
apostrophe is not feasible, enclose it in a pair of '%<' and '%>' directives 
instead
 1451 |   "Can't find suitable multilib set for %<-march=%s%>/%<-mabi=%s%>",
  |   ^
../../gcc/common/config/riscv/riscv-common.cc: At global scope:
../../gcc/common/config/riscv/riscv-common.cc:1492:1: error: 'int 
riscv_check_conds(const switchstr*, int, int, const 
std::vector >&)' defined but not used 
[-Werror=unused-function]
 1492 | riscv_check_conds (
  | ^
../../gcc/common/config/riscv/riscv-common.cc:1374:1: error: 'const char* 
find_last_appear_switch(const switchstr*, int, const char*)' defined but not 
used [-Werror=unused-function]
 1374 | find_last_appear_switch (
  | ^~~
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:2442: riscv-common.o] Error 1

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


Re: [PATCH 2/2] RISC-V: Implement TARGET_COMPUTE_MULTILIB

2021-09-15 Thread Kito Cheng via Gcc-patches
> I find the other_cond support a bit confusing.  Is this for -mcmodel
> perhaps?  Why not just say that if so?

I suppose we might have other multilib options other than -march,
-mabi and -mcmodel,
so I keep the flexibility here.

> riscv_multi_lib_info_t::parse
> Calls riscv_subset_list::parse twice when path == ".", the call inside
> the if looks unnecessary.

Thanks, good catch !

> It isn't clear how the loop with the comment "ignore march and mabi option
> in cond string" can work.  It looks like it computes other_cond, but
> assumes that there is at most one other_cond, and that it is always at the
> end of the list since otherwise the length won't be computed correctly.
> But it doesn't check these constraints.  Do you have examples showing how
> this works?
>   And maybe a little better commentary explaining what this loop does to
> make it easier to understand.  It doesn't mention that it computes
> other_cond for instance.

Seriously, I also spend some time remembering what they are doing...so
I rewrite that to make that easier to understand instead of copying
gcc.c if possible.


Re: [PATCH 2/2] RISC-V: Implement TARGET_COMPUTE_MULTILIB

2021-08-31 Thread Jim Wilson
On Tue, Aug 31, 2021 at 5:22 PM Jim Wilson  wrote:

> On Wed, Jul 21, 2021 at 2:28 AM Kito Cheng  wrote:
>
>> Use TARGET_COMPUTE_MULTILIB to search the multi-lib reuse for
>> riscv*-*-elf*,
>> according following rules:
>>
>
> I find the other_cond support a bit confusing.  Is this for -mcmodel
> perhaps?  Why not just say that if so?
>
> match_score:
> weigth -> weight
>
> riscv_multi_lib_info_t::parse
> Calls riscv_subset_list::parse twice when path == ".", the call inside
> the if looks unnecessary.
>
> riscv_multilib_lib_check:
> Can't found -> Can't find
>
> riscv_check_other_cond:
> might got -> might get
>
> riscv_compute_multilib:
> bare-matel -> bare-metal
> decition -> decision
> dection -> decision
>
> It isn't clear how the loop with the comment "ignore march and mabi
> option in cond string" can work.  It looks like it computes other_cond,
> but assumes that there is at most one other_cond, and that it is always
> at the end of the list since otherwise the length won't be computed
> correctly.  But it doesn't check these constraints.  Do you have examples
> showing how this works?
>   And maybe a little better commentary explaining what this loop does to
> make it easier to understand.  It doesn't mention that it computes
> other_cond for instance.
>

Otherwise it looks OK to me.

Jim


Re: [PATCH 2/2] RISC-V: Implement TARGET_COMPUTE_MULTILIB

2021-08-31 Thread Jim Wilson
On Wed, Jul 21, 2021 at 2:28 AM Kito Cheng  wrote:

> Use TARGET_COMPUTE_MULTILIB to search the multi-lib reuse for
> riscv*-*-elf*,
> according following rules:
>

I find the other_cond support a bit confusing.  Is this for -mcmodel
perhaps?  Why not just say that if so?

match_score:
weigth -> weight

riscv_multi_lib_info_t::parse
Calls riscv_subset_list::parse twice when path == ".", the call inside
the if looks unnecessary.

riscv_multilib_lib_check:
Can't found -> Can't find

riscv_check_other_cond:
might got -> might get

riscv_compute_multilib:
bare-matel -> bare-metal
decition -> decision
dection -> decision

It isn't clear how the loop with the comment "ignore march and mabi option
in cond string" can work.  It looks like it computes other_cond, but
assumes that there is at most one other_cond, and that it is always at the
end of the list since otherwise the length won't be computed correctly.
But it doesn't check these constraints.  Do you have examples showing how
this works?
  And maybe a little better commentary explaining what this loop does to
make it easier to understand.  It doesn't mention that it computes
other_cond for instance.

Jim