From da6dccc18fd30bfa143849a3995b88c4c51c6e66 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Fri, 12 May 2023 17:37:13 +0200 Subject: Revert "Refactor opcode.pl - with c99 array init index comments are not necessary" This reverts commit f6405b442f40de7d3697fcd885bfbfa9ba55eab0. --- regen/opcode.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/regen/opcode.pl b/regen/opcode.pl index 1dbd77aca1..d57df8ceea 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -780,7 +780,7 @@ sub print_PL_op_private_tables { else { $index = -1; } - $PL_op_private_bitdef_ix .= sprintf "\t${\ ::op_index ($op) } = %4d,\n", $index; + $PL_op_private_bitdef_ix .= sprintf "\t${\ ::op_index ($op) } = %4d, /* %s */\n", $index, $op; } if (%not_seen) { die "panic: unprocessed ops: ". join(',', keys %not_seen); @@ -818,7 +818,7 @@ sub print_PL_op_private_tables { # all bets are off @flags = '0xff' if $op eq 'null' or $op eq 'custom'; - $PL_op_private_valid .= sprintf "\t${\ ::op_index ($op) } = (%s),\n", + $PL_op_private_valid .= sprintf "\t${\ ::op_index ($op) } = /* %-10s */ (%s),\n", uc($op), @flags ? join('|', @flags): '0'; } @@ -1144,8 +1144,12 @@ sub generate_opcode_h_pl_check { INIT({ END + my ($max) = sort { $b cmp $a } map { length "Perl_$check{$_}" } @ops; + + my $align = $max + 2; # comma and space + for (@ops) { - print "\t", op_index ($_), " = Perl_$check{$_},\n"; + print "\t", op_index ($_), " = ", align ($align, "Perl_$check{$_},"), "/* $_ */\n"; } print <<~'END'; @@ -1200,7 +1204,7 @@ sub generate_opcode_h_pl_opargs { $argshift += 4; } $argsum = sprintf("0x%08x", $argsum); - print "\t", op_index ($op), " = $argsum,\n"; + print "\t", op_index ($op), " = $argsum,", " /* $op */\n"; } print <<~'END'; -- cgit v1.2.1