riscv: Fix bootstrap [PR109384]

Message ID ZCvnXt00qMrZyJSM@tucnak
State Unresolved
Headers
Series riscv: Fix bootstrap [PR109384] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jakub Jelinek April 4, 2023, 9:01 a.m. UTC
  Hi!

The following patch unbreaks riscv bootstrap, where it previously failed
on -Werror=format-diag warning promoted to error.

Ok for trunk?

Or shall it say e.g.
"%<-march=%s%>: %<zfinx%> extension conflicts with %<f>"
?
Or say if the current condition is true, do
const char *ext = "zfinx";
if (subset_list->lookup ("zdinx"))
  ext = "zdinx";
else if (subset_list->lookup ("zhinx"))
  ext = "zhinx";
else if (subset_list->lookup ("zhinxmin"))
  ext = "zhinxmin";
and
"%<-march=%s%>: %qs extension conflicts with %<f>", arch, ext
?  Or do similar check for which extension to print against it,
const char *ext = "zfinx";
const char *ext2 = "f";
if (subset_list->lookup ("zdinx"))
  {
    ext = "zdinx";
    if (subset_list->lookup ("d"))
      ext2 = "d";
  }
else if (subset_list->lookup ("zhinx"))
  {
    ext = "zhinx";
    if (subset_list->lookup ("zfh"))
      ext2 = "zfh";
  }
else if (subset_list->lookup ("zhinxmin"))
  {
    ext = "zhinxmin";
    if (subset_list->lookup ("zfhmin"))
      ext2 = "zfhmin";
  }
"%<-march=%s%>: %qs extension conflicts with %qs", arch, ext, ext2
?

2023-04-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/109384
	* common/config/riscv/riscv-common.cc (riscv_subset_list::parse):
	Reword diagnostics about zfinx conflict with f, formatting fixes.

	* gcc.target/riscv/arch-19.c: Expect a different message about zfinx
	vs. f conflict.


	Jakub
  

Comments

Kito Cheng April 4, 2023, 9:18 a.m. UTC | #1
ok, thanks!

On Tue, Apr 4, 2023 at 5:01 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> The following patch unbreaks riscv bootstrap, where it previously failed
> on -Werror=format-diag warning promoted to error.
>
> Ok for trunk?
>
> Or shall it say e.g.
> "%<-march=%s%>: %<zfinx%> extension conflicts with %<f>"
> ?
> Or say if the current condition is true, do
> const char *ext = "zfinx";
> if (subset_list->lookup ("zdinx"))
>   ext = "zdinx";
> else if (subset_list->lookup ("zhinx"))
>   ext = "zhinx";
> else if (subset_list->lookup ("zhinxmin"))
>   ext = "zhinxmin";
> and
> "%<-march=%s%>: %qs extension conflicts with %<f>", arch, ext
> ?  Or do similar check for which extension to print against it,
> const char *ext = "zfinx";
> const char *ext2 = "f";
> if (subset_list->lookup ("zdinx"))
>   {
>     ext = "zdinx";
>     if (subset_list->lookup ("d"))
>       ext2 = "d";
>   }
> else if (subset_list->lookup ("zhinx"))
>   {
>     ext = "zhinx";
>     if (subset_list->lookup ("zfh"))
>       ext2 = "zfh";
>   }
> else if (subset_list->lookup ("zhinxmin"))
>   {
>     ext = "zhinxmin";
>     if (subset_list->lookup ("zfhmin"))
>       ext2 = "zfhmin";
>   }
> "%<-march=%s%>: %qs extension conflicts with %qs", arch, ext, ext2
> ?
>
> 2023-04-04  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/109384
>         * common/config/riscv/riscv-common.cc (riscv_subset_list::parse):
>         Reword diagnostics about zfinx conflict with f, formatting fixes.
>
>         * gcc.target/riscv/arch-19.c: Expect a different message about zfinx
>         vs. f conflict.
>
> --- gcc/common/config/riscv/riscv-common.cc.jj  2023-04-04 10:46:33.473871184 +0200
> +++ gcc/common/config/riscv/riscv-common.cc     2023-04-04 10:41:22.014477456 +0200
> @@ -1153,10 +1153,9 @@ riscv_subset_list::parse (const char *ar
>
>    subset_list->handle_combine_ext ();
>
> -  if (subset_list->lookup("zfinx") && subset_list->lookup("f"))
> -       error_at (loc,
> -       "%<-march=%s%>: z*inx is conflict with float extensions",
> -       arch);
> +  if (subset_list->lookup ("zfinx") && subset_list->lookup ("f"))
> +    error_at (loc, "%<-march=%s%>: z*inx conflicts with floating-point "
> +                  "extensions", arch);
>
>    return subset_list;
>
> --- gcc/testsuite/gcc.target/riscv/arch-19.c.jj 2023-03-29 22:37:11.465651690 +0200
> +++ gcc/testsuite/gcc.target/riscv/arch-19.c    2023-04-04 10:45:50.734503089 +0200
> @@ -1,4 +1,4 @@
>  /* { dg-do compile } */
>  /* { dg-options "-march=rv64if_zfinx -mabi=lp64" } */
>  int foo() {}
> -/* { dg-error "'-march=rv64if_zfinx': z\\*inx is conflict with float extensions" "" { target *-*-* } 0 } */
> +/* { dg-error "'-march=rv64if_zfinx': z\\*inx conflicts with floating-point extensions" "" { target *-*-* } 0 } */
>
>         Jakub
>
  

Patch

--- gcc/common/config/riscv/riscv-common.cc.jj	2023-04-04 10:46:33.473871184 +0200
+++ gcc/common/config/riscv/riscv-common.cc	2023-04-04 10:41:22.014477456 +0200
@@ -1153,10 +1153,9 @@  riscv_subset_list::parse (const char *ar
 
   subset_list->handle_combine_ext ();
 
-  if (subset_list->lookup("zfinx") && subset_list->lookup("f"))
-	error_at (loc,
-	"%<-march=%s%>: z*inx is conflict with float extensions",
-	arch);
+  if (subset_list->lookup ("zfinx") && subset_list->lookup ("f"))
+    error_at (loc, "%<-march=%s%>: z*inx conflicts with floating-point "
+		   "extensions", arch);
 
   return subset_list;
 
--- gcc/testsuite/gcc.target/riscv/arch-19.c.jj	2023-03-29 22:37:11.465651690 +0200
+++ gcc/testsuite/gcc.target/riscv/arch-19.c	2023-04-04 10:45:50.734503089 +0200
@@ -1,4 +1,4 @@ 
 /* { dg-do compile } */
 /* { dg-options "-march=rv64if_zfinx -mabi=lp64" } */
 int foo() {}
-/* { dg-error "'-march=rv64if_zfinx': z\\*inx is conflict with float extensions" "" { target *-*-* } 0 } */
+/* { dg-error "'-march=rv64if_zfinx': z\\*inx conflicts with floating-point extensions" "" { target *-*-* } 0 } */