public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] options: Prevent multidimensional arrays
@ 2023-10-02  8:02 Kito Cheng
  2023-10-04 13:40 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: Kito Cheng @ 2023-10-02  8:02 UTC (permalink / raw)
  To: gerald, jbglaw, gcc-patches, kito.cheng, jeffreyalaw, wangfeng; +Cc: Kito Cheng

Multidimensional arrary is gawk extension, and we accidentally
introduced that in recent commit[1].

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e4a4b8e983bac865eb435b11798e38d633b98942

gcc/ChangeLog:

	* opt-read.awk: Drop multidimensional arrays.
	* opth-gen.awk: Ditto.
---
 gcc/opt-read.awk | 4 ++--
 gcc/opth-gen.awk | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk
index fcf92853957..f74d8478f72 100644
--- a/gcc/opt-read.awk
+++ b/gcc/opt-read.awk
@@ -123,7 +123,7 @@ BEGIN {
 			}
 			else {
 				target_var = opt_args("Var", $0)
-                                if (target_var)
+				if (target_var)
 				{
 					target_var = opt_args("Var", $1)
 					var_index = find_index(target_var, target_vars, n_target_vars)
@@ -131,7 +131,7 @@ BEGIN {
 					{
 						target_vars[n_target_vars++] = target_var
 					}
-					other_masks[var_index][n_other_mask[var_index]++] = name
+					other_masks[var_index "," n_other_mask[var_index]++] = name
 				}
 				else
 				{
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 70ca3d37719..c4398be2f3a 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -412,9 +412,9 @@ for (i = 0; i < n_target_vars; i++)
 		continue
 	for (j = 0; j < n_other_mask[i]; j++)
 	{
-		print "#define MASK_" other_masks[i][j] " (1U << " other_masknum[i][""]++ ")"
+		print "#define MASK_" other_masks[i "," j] " (1U << " other_masknum[i]++ ")"
 	}
-	if (other_masknum[i][""] > 32)
+	if (other_masknum[i] > 32)
 		print "#error too many target masks for" extra_target_vars[i]
 }
 
@@ -437,8 +437,8 @@ for (i = 0; i < n_target_vars; i++)
 		continue
 	for (j = 0; j < n_other_mask[i]; j++)
 	{
-		print "#define TARGET_" other_masks[i][j] \
-		      " ((" target_vars[i] " & MASK_" other_masks[i][j] ") != 0)"
+		print "#define TARGET_" other_masks[i "," j] \
+		      " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)"
 	}
 }
 print ""
-- 
2.40.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] options: Prevent multidimensional arrays
  2023-10-02  8:02 [PATCH] options: Prevent multidimensional arrays Kito Cheng
@ 2023-10-04 13:40 ` Kito Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Kito Cheng @ 2023-10-04 13:40 UTC (permalink / raw)
  To: Kito Cheng; +Cc: gerald, jbglaw, gcc-patches, jeffreyalaw, wangfeng

committed to trunk, got approval from Jeff in another mail thread:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/631873.html :)

On Mon, Oct 2, 2023 at 4:03 PM Kito Cheng <kito.cheng@sifive.com> wrote:
>
> Multidimensional arrary is gawk extension, and we accidentally
> introduced that in recent commit[1].
>
> [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e4a4b8e983bac865eb435b11798e38d633b98942
>
> gcc/ChangeLog:
>
>         * opt-read.awk: Drop multidimensional arrays.
>         * opth-gen.awk: Ditto.
> ---
>  gcc/opt-read.awk | 4 ++--
>  gcc/opth-gen.awk | 8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk
> index fcf92853957..f74d8478f72 100644
> --- a/gcc/opt-read.awk
> +++ b/gcc/opt-read.awk
> @@ -123,7 +123,7 @@ BEGIN {
>                         }
>                         else {
>                                 target_var = opt_args("Var", $0)
> -                                if (target_var)
> +                               if (target_var)
>                                 {
>                                         target_var = opt_args("Var", $1)
>                                         var_index = find_index(target_var, target_vars, n_target_vars)
> @@ -131,7 +131,7 @@ BEGIN {
>                                         {
>                                                 target_vars[n_target_vars++] = target_var
>                                         }
> -                                       other_masks[var_index][n_other_mask[var_index]++] = name
> +                                       other_masks[var_index "," n_other_mask[var_index]++] = name
>                                 }
>                                 else
>                                 {
> diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
> index 70ca3d37719..c4398be2f3a 100644
> --- a/gcc/opth-gen.awk
> +++ b/gcc/opth-gen.awk
> @@ -412,9 +412,9 @@ for (i = 0; i < n_target_vars; i++)
>                 continue
>         for (j = 0; j < n_other_mask[i]; j++)
>         {
> -               print "#define MASK_" other_masks[i][j] " (1U << " other_masknum[i][""]++ ")"
> +               print "#define MASK_" other_masks[i "," j] " (1U << " other_masknum[i]++ ")"
>         }
> -       if (other_masknum[i][""] > 32)
> +       if (other_masknum[i] > 32)
>                 print "#error too many target masks for" extra_target_vars[i]
>  }
>
> @@ -437,8 +437,8 @@ for (i = 0; i < n_target_vars; i++)
>                 continue
>         for (j = 0; j < n_other_mask[i]; j++)
>         {
> -               print "#define TARGET_" other_masks[i][j] \
> -                     " ((" target_vars[i] " & MASK_" other_masks[i][j] ") != 0)"
> +               print "#define TARGET_" other_masks[i "," j] \
> +                     " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)"
>         }
>  }
>  print ""
> --
> 2.40.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-04 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02  8:02 [PATCH] options: Prevent multidimensional arrays Kito Cheng
2023-10-04 13:40 ` Kito Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).