perl5
perl5 copied to clipboard
[Cleanup] Move opcode data initialization from headers into dedicated C file
Planned follow-ups (long run, this PR has been waiting almost 2 years):
- -use designated array initializers (should not make problems in internal C-files)-
- extend data with "not supported" message, moving for example usage of
PL_no_dir_funcfrompp_sys.cinto singlePL_not_supportedfunction - provide accessor functions instead of direct data access
- allows introduction of custom op codes, may be interesting for some grammar extension
- merge data into single structure
- allows unified handling of unavailable op, see for example difference between
read(handled inopcode.h) andreaddir/open_dir(handled inpp_sys.c)
Example of structure declaration (here using designated initializers for readability)
#define PL_no_dir_func "Unsupported directory function \"%s\" called"
#if defined(Direntry_t) && defined(HAS_READDIR)
# define PL_PLATFORM_PP_READDIR Perl_pp_readdir
#else
# define PL_PLATFORM_PP_READDIR Perl_pp_unsupported
#endif
[OP_READDIR] = {
.op_name = "readdir",
.op_desc = "readdir",
.op_ppaddr = PL_PLATFORM_PP_READDIR,
.op_check = Perl_ck_fun,
.op_opargs = 0x00006b00,
.op_private_labels = 'U',
.op_private_bitdef_ix = 0,
.op_unsupported = PL_no_dir_func,
}
Can you address the porting test failures reported in https://github.com/Perl/perl5/actions/runs/10548400876/job/29222271299?pr=22540, then re-push?
Issuing a pull request that is going to fail multiple tests (porting or otherwise) is not helpful to potential code reviewers.
Can you address the porting test failures reported in https://github.com/Perl/perl5/actions/runs/10548400876/job/29222271299?pr=22540, then re-push?
just re-pushed ... had to rethink my approach due tests relying in symbols defined in globals.o
- use designated array initializers (should not make problems in internal C-files)
We have developers who build perl with C++ compilers, and designated array initializers aren't in any C++ standard (g++ allows it anyway, MSVC doesn't).
- use designated array initializers (should not make problems in internal C-files)
We have developers who build perl with C++ compilers, and designated array initializers aren't in any C++ standard (g++ allows it anyway, MSVC doesn't).
shame, such a nice feature improving readability of code :-( updating PR comment