diff options
author | Branislav ZahradnĂk <barney@cpan.org> | 2022-10-16 18:46:11 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-11-05 08:54:45 +0100 |
commit | 7d6820a7bf5204bb7deddbc63f79c71ef2cb6098 (patch) | |
tree | f7b328b2a0aa12e9ae79333f1bf244c502f6f366 /regen/opcode.pl | |
parent | 87b8f6cdf21ec72becc0eaf89f63bb1d8cb7719d (diff) | |
download | perl-7d6820a7bf5204bb7deddbc63f79c71ef2cb6098.tar.gz |
Refactor opcode.pl - use INIT() macro instead of #ifdef/#endif
Diffstat (limited to 'regen/opcode.pl')
-rwxr-xr-x | regen/opcode.pl | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/regen/opcode.pl b/regen/opcode.pl index 4cbf6c1312..8270c59dc8 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -1076,10 +1076,7 @@ sub generate_opcode_h_opnames { print <<~'END'; START_EXTERN_C - #ifndef DOINIT - EXTCONST char* const PL_op_name[]; - #else - EXTCONST char* const PL_op_name[] = { + EXTCONST char* const PL_op_name[] INIT({ END for (@ops) { @@ -1088,13 +1085,9 @@ sub generate_opcode_h_opnames { print <<~'END'; "freed", - }; - #endif + }); - #ifndef DOINIT - EXTCONST char* const PL_op_desc[]; - #else - EXTCONST char* const PL_op_desc[] = { + EXTCONST char* const PL_op_desc[] INIT({ END for (@ops) { @@ -1107,9 +1100,8 @@ sub generate_opcode_h_opnames { } print <<~'END'; - "freed op", - }; - #endif + "freed op", + }); END_EXTERN_C END @@ -1119,8 +1111,7 @@ sub generate_opcode_h_pl_check { print <<~'END'; EXT Perl_check_t PL_check[] /* or perlvars.h */ - #if defined(DOINIT) - = { + INIT({ END for (@ops) { @@ -1128,9 +1119,7 @@ sub generate_opcode_h_pl_check { } print <<~'END'; - } - #endif - ; + }); END } @@ -1140,10 +1129,7 @@ sub generate_opcode_h_pl_opargs { print <<~'END'; - #ifndef DOINIT - EXTCONST U32 PL_opargs[]; - #else - EXTCONST U32 PL_opargs[] = { + EXTCONST U32 PL_opargs[] INIT({ END for my $op (@ops) { @@ -1188,8 +1174,7 @@ sub generate_opcode_h_pl_opargs { } print <<~'END'; - }; - #endif + }); END_EXTERN_C END @@ -1203,8 +1188,7 @@ sub generate_opcode_h_pl_ppaddr { START_EXTERN_C EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ - #if defined(DOINIT) - = { + INIT({ END for (@ops) { @@ -1218,9 +1202,7 @@ sub generate_opcode_h_pl_ppaddr { } print <<~'END'; - } - #endif - ; + }); END } |