summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Timmermans <fawaka@gmail.com>2023-05-12 17:37:13 +0200
committerLeon Timmermans <fawaka@gmail.com>2023-05-15 13:51:30 +0200
commitda6dccc18fd30bfa143849a3995b88c4c51c6e66 (patch)
tree7c8e32632c1796f38c4604d2b9d7ae9bc9f38b54
parent4444b686fe81034adfb9d3c9b1eb1d120db07551 (diff)
downloadperl-da6dccc18fd30bfa143849a3995b88c4c51c6e66.tar.gz
Revert "Refactor opcode.pl - with c99 array init index comments are not necessary"
This reverts commit f6405b442f40de7d3697fcd885bfbfa9ba55eab0.
-rwxr-xr-xregen/opcode.pl12
1 files 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';