Branch: refs/heads/davem/xs_refactor5 Home: https://github.com/Perl/perl5 Commit: 69864d9a5ac17bf15bfb560c1c08977dc527eb6e https://github.com/Perl/perl5/commit/69864d9a5ac17bf15bfb560c1c08977dc527eb6e Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024)
Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm M dist/ExtUtils-ParseXS/lib/perlxs.pod Log Message: ----------- ParseXS: bump version 3.54 => 3.55 Commit: ffa2c82d0094dafdcd6546847156a842f1392438 https://github.com/Perl/perl5/commit/ffa2c82d0094dafdcd6546847156a842f1392438 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: param_check(): refactor: rename lex var Rename $argsref to $param for consistency with param_check() etc. No functional changes. Commit: b7ad367f55aae51b8316935d23106ff97015b05b https://github.com/Perl/perl5/commit/b7ad367f55aae51b8316935d23106ff97015b05b Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: INPUT_handler(): update code comments One code comment referred to something that has since been changed: update it. Also add a comment about how INPUT lines are split by a regex. Commit: 2df9fb3255a5d2b1be51167254d397d5a3cf1109 https://github.com/Perl/perl5/commit/2df9fb3255a5d2b1be51167254d397d5a3cf1109 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: INPUT_handler(): refactor: add $init_op This sub looks for an initialiser string, which starts with a /[=+;]/. This commit extracts out that first character into a separate variable, $init_op, which will make further refactoring easier. Should be no functional changes. Commit: 2b42d0cc390a75d79a83cf16949881a49e522249 https://github.com/Perl/perl5/commit/2b42d0cc390a75d79a83cf16949881a49e522249 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: INPUT_handler(): refactor: add $is_alien Flag more explicitly that a var is declared in an INPUT line but not in the XSUB's signature (rather than just relying on $var_num not being defined). Should be no functional changes. Commit: 36118f523541d3e74ab495202ca8efbd9c9611b5 https://github.com/Perl/perl5/commit/36118f523541d3e74ab495202ca8efbd9c9611b5 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M MANIFEST M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm A dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: add Node.pm, Node::Param class Add the file lib/ExtUtils/ParseXS/Node.pm, and in it, define a base class and one derived class: ExtUtils::ParseXS::Node ExtUtils::ParseXS::Node::Param; Then use the Node::Param class within ParseXS.pm to store details about a particular XSUB's params. Currently this just involves upgrading a few hash refs into proper Node::Param objects. There are no methods yet to operate on such objects: the current methods in class ExtUtils::ParseXS expect a hash as an arg, and that's what they get passed - they don't care that the hash is now blessed. Soon, those methods will instead be made methods of the Node::Param class. This commit is the very first baby step into making the XS parser generate an Abstract Syntax Tree (AST). Currently the parser generates C code on the fly, maintaining just the minimum state necessary for that task. I intend over time to (hopefully) gradually store more state in Node::Foo objects, and rather than throwing the objects away after their immediate use, to combine them into bigger and bigger subtrees, until eventually there is a tree which represents an entire XS file. Commit: a1521bcebcb87ee2e53237c8122addbae6ba4e19 https://github.com/Perl/perl5/commit/a1521bcebcb87ee2e53237c8122addbae6ba4e19 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor param_check() & generate_init() Rename these methods to check() and as_code(), and make them be methods of the new ExtUtils::ParseXS::Node::Param class, instead of ExtUtils::ParseXS. Should be no functional changes, unless someone has been calling these private methods directly. The diff looks complex, but it's mostly just swapping round which arg is the Param object and which is the ParseXS object; and then doing a general s/\$self/\$xps/g and s/\$param/\$self/g within the methods. The next commit will move the two methods into Node.pm. Commit: 4d4b05cb9202daa127371d0867ab08f08c1c9dc2 https://github.com/Perl/perl5/commit/4d4b05cb9202daa127371d0867ab08f08c1c9dc2 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: move check() and as_code() into Node.pm The previous commit made those two functions be methods of ExtUtils::ParseXS::Node::Param; now move those two functions into Node.pm where they belong. No functional changes; just a literal cut+paste, except for no longer needing the full package name in the sub declaration, so sub ExtUtils::ParseXS::Node::Param::check { becomes sub check { etc. Commit: 7e3ae86dc19d3be9a0f4f6af979628ea1c2924f4 https://github.com/Perl/perl5/commit/7e3ae86dc19d3be9a0f4f6af979628ea1c2924f4 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: re-indent two subs in Node.pm The previous commit moved those subs from ParseXS.pm (where indentation is 2 columns) to the new Node.pm file (where the indentation is 4 columns, because I created that file and so I get to choose). This commit re-indents those subs to match the 4-indent. Whitespace and line re-wrapping changes only. Commit: 24bd513e07c634c6505ab967384d67911634a6b5 https://github.com/Perl/perl5/commit/24bd513e07c634c6505ab967384d67911634a6b5 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: rename two Node::Param fields Rename a couple of fields in ExtUtils::ParseXS::Node::Param for clarity and/or consistency: num => arg_num ansi => is_ansi Should be no functional changes. Commit: cbf9191ed3ba1d83b5f1cd07ab058e0010d87166 https://github.com/Perl/perl5/commit/cbf9191ed3ba1d83b5f1cd07ab058e0010d87166 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: XSUB signature-splitting This is the first of a few commits which will refactor the code which splits and processes the parameters in an XSUB's signature, such as '(IN char* s, int n = 0)' The code currently has three separate initial splitting/processing loops. This commit combines two of those into a common loop. The next commit will combine the third one. The biggest loop uses a complex regex to split the signature on commas into separate parameters, but where something like (char c = ',', int n = 0) correctly ignores the quoted comma. The other two loops are essentially fallbacks: one where the regex doesn't work, and the other in the presence of the -noargtypes switch. The code was structured along the lines of: my @args; if (config_allow_argtypes) { # ANSI-style Sig if (can split using regex) { @args = /regex/g; for (@args) { # big loop to do lots of processing of all the extra syntactical features allowed with a full ANSI-style signature, i.e. IN/OUT, type, and length(foo), leaving the elements of @_ with all the extra stuff stripped. } } else { @args = split /,/, ...; Warn "Warning: cannot parse argument list"; } } else { # K&R-style Sig @args = split /,/, ...; if (config_allow_inout) { # process IN/OUT etc } for (@args) { # do common K&R syntax processing of each parameter } This commit merges the first two branches, so the code in outline now looks like: my @args; if (config_allow_argtypes) { if (can split using regex) { @args = /regex/g; else { @args = split /,/, ...; Warn "Warning: cannot parse argument list"; } for (@args) { # do lots of processing of all the extra syntactical # features allowed with a full ANSI-style signature, # i.e. IN/OUT, type, length(foo) } } .... In theory this is a change in behaviour, since the "can't split with regex" branch now does full ANSI-style processing of the parameters, albeit ones which possibly haven't been split correctly. But since this branch is supposed never to be taken, and would only ever be taken if there was a design flaw in the regex which meant it couldn't smartly split on commas, I don't think this really matters. Commit: a399a4923c7f15aa1aa5bdb38a5dccf59ef51678 https://github.com/Perl/perl5/commit/a399a4923c7f15aa1aa5bdb38a5dccf59ef51678 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: refactor: XSUB signature-processing The previous commit reduced the three separate XSUB signature-splitting and initial processing branches into two. This commit reduces it to a single common block of code. It also heavily refactors the initial parameter processing code, and adds several new checks. In outline: before this commit, the sig splitting and processing code looked like: my @args; if (config_allow_argtypes) { # ANSI-style Sig if (can split using regex) { @args = /regex/g; for (@args) { # big loop to do lots of processing of all the extra syntactical features allowed with a full ANSI-style signature, i.e. IN/OUT, type, and length(foo), leaving the elements of @_ with all the extra stuff stripped. } } else { @args = split /,/, ...; Warn "Warning: cannot parse argument list"; } } else { # K&R-style Sig @args = split /,/, ...; if (config_allow_inout) { # process IN/OUT etc } for (@args) { # do common K&R syntax processing of each parameter } Following this commit, it now looks like: my @args; if (can split using regex) { @args = /regex/g; } else { @args = split /,/, ...; Warn "Warning: cannot parse argument list"; } for (@args) { # big loop to do lots of processing of all the extra syntactical features allowed with a full ANSI-style signature, i.e. IN/OUT, type, and length(foo), leaving the elements of @_ with all the extra stuff stripped. $self->blurt("type not allowed") if defined $type && !$self{config_allow_argtypes}; # ... and similar error checks ... } for (@args) { # do common K&R syntax processing of each parameter } So under -noargtypes, instead of parsing a parameter by using a separate block of code which doesn't know about the new syntactical features like types etc, always parse using code which understands all the extra stuff, but which then errors out with a specific error message if it finds something disallowed under -noargtypes. This is better than previously, where the forbidden thing was simply not understood by the parsing code, and might trigger a confusing generic error, or be silently accepted and cause malformed C code to be emitted. The new errors are: "parameter type not allowed under -noargtypes") "length() pseudo-parameter not allowed under -noargtypes") "parameter IN/OUT modifier not allowed under -noinout") "Unparseable XSUB parameter: '$_'"); "Default value not allowed on length() parameter '$name'" That last one was already an error, but the text has been changed from: "Default value on length() argument: '$_'" and it now does a $self->blurt() rather than a plain 'die', so the correct line number is reported, and parsing can continue, looking for further errors. The next few commits will be moving all the code within that "do common K&R syntax processing" block into the first 'for (@args)' loop, eventually removing the second loop altogether. Commit: 277e0fe285e92f069f4918dcb8c485d5cb7e2085 https://github.com/Perl/perl5/commit/277e0fe285e92f069f4918dcb8c485d5cb7e2085 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: make $report_args an array Rather than iteratively appending to a comma-separated string of params on the fly, push them into an array; then join and quote-escape them only when used. Makes the code simpler. Also rename the variable to @report_params since it holds parameter names, not arguments. Should be no functional changes Commit: 8e30005a5a69d5acb656e6e512e0ea3c4b3356f7 https://github.com/Perl/perl5/commit/8e30005a5a69d5acb656e6e512e0ea3c4b3356f7 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: rationalise '...' in XSUB signature XSUBs are allowed to have a trailing ellipsis in the signature to disable arg count checking: int foo(a, b, ...) The current code which parses this is very dumb and broken. It doesn't complain about ellipses occurring in positions other than the last, and more bizarrely it actually deletes any embedded ellipis. So for example the default expression in foo(int a, char *b = "stuff ...", int c = 0) gets modified from "stuff ..." into "stuff ". It also emits broken code for the arguments of a wrapped function; i.e. int foo(a, b, ...) embeds a call to the C function 'foo' which looks like: foo(a, b,) Although auto-call with ellipsis doesn't necessarily make much sense, this commit changes it to be 'foo(a, b)' which at least compiles. This commit adds some tests too. Commit: 0680c70d98678d1550cb44eabb1659faa6ff98ff https://github.com/Perl/perl5/commit/0680c70d98678d1550cb44eabb1659faa6ff98ff Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: centralise default arg parsing There are two 'for (@args)' parsing loops, and the processing of the '= default_expr' part of a parameter is currently split between the two loops. This commit moves everything into the first loop: this is one of a series of commits aimed at the complete elimination of the second loop. It also stores the default value expression in its original form, and now defers any quote-escaping to the code output stage. In theory, no functional changes. Commit: 5283a7dcd9562cda47519ae4d812d9f3f5e5c736 https://github.com/Perl/perl5/commit/5283a7dcd9562cda47519ae4d812d9f3f5e5c736 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: refactor/fix: move CLASS/THIS sig parsing There are currently two 'for (@args)' parsing loops to parse an XSUB's signature. Move the special-case code for handling a C++ XSUB's initial THIS/CLASS parameter from before the second loop to before the first loop. This is one of a series of commits aimed at the complete elimination of the second loop. This commit also fixes a bug introduced a couple of commits ago that caused the initial "THIS" or "CLASS" arg in this emitted code's error message to be be skipped: if (items < N) croak("usage: foo(...)") This commit also adds some tests for THIS/CLASS in usage message and autocall parameters. Commit: 9073de164fe82b1c6e025735678799171e228823 https://github.com/Perl/perl5/commit/9073de164fe82b1c6e025735678799171e228823 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: move arg index calc earlier There are currently two 'for (@args)' parsing loops to parse an XSUB's signature. Move the code from the second to the first loop which determines the arg number (if any) associated with each parameter. This is one of a series of commits aimed at the complete elimination of the second loop. Commit: ceed598ef6513013794c1898b507a8a6a2fef5e9 https://github.com/Perl/perl5/commit/ceed598ef6513013794c1898b507a8a6a2fef5e9 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm M dist/ExtUtils-ParseXS/t/110-assign_func_args.t Log Message: ----------- ParseXS: refactor: add Node::Sig class Add a ExtUtils::ParseXS::Node::Sig class. This is is a subclass of Node which is intended to hold all the info parsed and extracted from an XSUB's signature plus any INPUT lines. It mainly consists of an array of Node::Param objects, which hold info about each parsed parameter, plus a hash which maps param names to those param objects. This commit does the basic work; subsequent commits will handle some individual cases which are more complex. The basic arrangement used to be like this: The XSUB's signature (such as "a, OUT b, int c, d = 999") was split and parsed, and the info about each parameter was stored in a collection of hashes; for example: $self->{xsub_map_argname_to_in_out}{b} = 'OUT'; $self->{xsub_map_argname_to_default}{d} = '999'; etc. In addition, a Node::Param object was created for each parameter which has the *type* specified (such as as 'c' above), and pushed onto the @ANSI_params array. Then, each INPUT line was parsed, stored as a temporary Node::Param object, then the as_code() method was called on that object, which emitted the C declaration and initialisation code for that parameter. as_code() would use the various {xsub_map_argname_to_foo} hashes to lookup information needed for the code generation (such as the default expression to emit). Finally, as_code() was called on each param in @ANSI_params, to emit declarations for params listed in the signature but not in an INPUT line. What this commit does is to replace all the various $self->{xsub_map_argname_to_foo} fields with a single $self->{xsub_sig} Node::Sig object; then it creates a Node::Param object for each parameter in the signature and stores them in the Sig object. This means that the info about each param is now stored in a single Node::Param object, rather than being stored across several hashes. A couple of more tricksy xsub_map_argname_to_foo fields have been left as-is for now, to be handled by individual commits to follow shortly. The INPUT processing is left largely unchanged for now: it still, for each INPUT line, creates a Node::Param object, calls as_code() on it, and then immediately frees it. The difference being that as_code() now looks up the info it needs from under $self->{xsub_sig} rather than from lots of hashes. The intention is that eventually those temporary INPUT objects won't be discarded, but will instead be merged into the list of Node::Params in the Node::Sig object. Code will then be emitted by iterating over the params in the Sig object once all sig/INPUT parsing is complete. This will be a significant step towards changing from an "emit code as we go along" model into a "parse everything into an AST then walk the tree, emitting code" model. Commit: 249c0eca53792c2af64589e1ae6dc84e78aebad2 https://github.com/Perl/perl5/commit/249c0eca53792c2af64589e1ae6dc84e78aebad2 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: move some seen INPUT flags Move the setting of $self->{xsub_seen_THIS_in_INPUT} $self->{xsub_seen_RETVAL_in_INPUT} back to INPUT_handler from the check() method. I moved them earlier when splitting out INPUT_handler() into separate parsing and checking functions, but really they should have stayed in INPUT_handler(). It's unlikely to make any functional difference, but logically they are flagging having literally seen a 'THIS' or 'RETVAL' in an INPUT line, and so belong there. Commit: dae8b3f712f6ef79734dfa9c23e6e50941fba5ce https://github.com/Perl/perl5/commit/dae8b3f712f6ef79734dfa9c23e6e50941fba5ce Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: make THIS/CLASS a param object Make the handling of an implied THIS or CLASS first parameter slightly more regular, by pushing a Node::Param object at the start of the list of param objects in the Node::Sig object. The code for this synthetic parameter is still emitted as a special-case: really it could be emitted at the same time as the ANSI-like parameters, but this commit keeps the emitted C declarations in the same order for now. It shouldn't make any difference, but you never know.... This commit breaks a few edge-case behaviours with C++ methods. The next five commits add tests and fixes. Commit: bc76237a830c03413d9931ba8fc7456009c1ca87 https://github.com/Perl/perl5/commit/bc76237a830c03413d9931ba8fc7456009c1ca87 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: fix code comment The xsub_class object field is a string, not a boolean. Commit: 8219ce6eb32770e6ee6a61854f102583f4156438 https://github.com/Perl/perl5/commit/8219ce6eb32770e6ee6a61854f102583f4156438 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: expand tests for C++ methods There are already some basic tests for C++ XSUBs (i.e. XSUBs which include a class in the function name). Expand the tests to cover what should be all the permutations of special cases, e.g. new/DESTROY, static method, etc. Commit: c5dbba8e3bf8f657fda9d35b596de2efad3974d8 https://github.com/Perl/perl5/commit/c5dbba8e3bf8f657fda9d35b596de2efad3974d8 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: ignore 'static' modifier on non-C++ XSUBs An XSUB can have a class as part of its function name, to indicate that it is a C++ method, It can also have a 'static' prefix on the return type to indicate that it is a class method. For example: static int X::Y::foo(...) However, 'static' without 'X::Y::' makes no sense, and generates invalid C code for an autocall. It's been this way since 5.000 AFAIKT. It's also recently started emitting an 'uninit var' warning. This commit detects the "static but no class" condition, emits a new warning, and turns off the flag which indicated that 'static' was present. The new warning is: "Ignoring 'static' type modifier:" . " only valid with an XSUB name which includes a class" Commit: 7715836a29f1ade4e982ee4a015e91059f7b899c https://github.com/Perl/perl5/commit/7715836a29f1ade4e982ee4a015e91059f7b899c Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: formally disallow dup THIS,CLASS If an XSUB's name includes a class, it is treated as a C++ method and an implicit initial 'THIS' or 'CLASS' parameter is added. If the XSUB also includes an explicit THIS/CLASS variable, Bad Things happen. There is in fact code in ParseXS.pm which detects 'THIS' in an INPUT line and suppresses the emitting of a duplicate C var declaration; but the generated C code is still wrong. For example, in X::Y::f(int THIS) the C code will expect 2 passed args, for both the implicit and explicit THIS, and the usage() message will be: croak_xs_usage(cv, "THIS, THIS") As it happens, the changes from 3 commits ago to THIS/CLASS handling turned such duplicate declarations into a compile-time error, .e.g. Error: duplicate definition of argument 'THIS' ignored in foo.xs, line N This commit adds tests for those changes, and also removes the now-redundant code from ParseXS which skips emitting a duplicate var definition, as the dup will already have been reported as an error by then. Commit: 919d86ba9870dbaa59e4f35b1a1c274fc582f808 https://github.com/Perl/perl5/commit/919d86ba9870dbaa59e4f35b1a1c274fc582f808 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: fix OUTPUT THIS C++ XSUB methods which indicate that the 'THIS' arg should be updated, such as My::Class::foo(int i) OUTPUT: THIS stopped emitting the update code as of 5 commits ago. Thus commit restores the behaviour, and adds tests. Commit: 5c0d1d65eebb4d145fe4e2bb9165a06e3439fb61 https://github.com/Perl/perl5/commit/5c0d1d65eebb4d145fe4e2bb9165a06e3439fb61 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: THIS tests: add tests for no STDERR noise For each set of tests in the THIS/CLASS block of tests, if there isn't any explicit test for expected STDERR values, add a test that STDERR was undef; i.e. explicitly test that there were no warnings or errors. To have a suitable description for the new tests, extract out the common prefix from the descriptions of each set of tests. Also, add an extra boolean field to each test indicating that the regex *shouldn't* match (this will be used in the next commit). Commit: 0877f115074c05224a74e6a1273c2afa1f842c7e https://github.com/Perl/perl5/commit/0877f115074c05224a74e6a1273c2afa1f842c7e Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: allow THIS/CLASS to be overridden For a long time, ParseXS allowed the type of the implicit THIS variable to be overridden. For example, while this: void X::Y::foo() would cause this line of C to be emitted: X__Y * THIS = ....; this : void X::Y::foo() int THIS would cause this line of C to be emitted: int THIS = ....; This wasn't documented, but might be useful and code out there might be relying on it. This was broken by me a few commits ago, and this commit restores the behaviour and adds tests. There is a similar issue for new() methods, which create an implicit CLASS parameter rather than THIS. In this case, ParseXS has *never* handled it correctly. This: void X::Y::new() int CLASS would cause *two* lines of C to be emitted: int CLASS = ....; char * CLASS = ....; This commit also fixes that, so now the type of both THIS *and* CLASS are overrideable. The fix works by adding a new field to the Node::Param object, 'soft_type', which is a type to be used unless explicitly overridden in an INPUT line. The code for this fix is a bit messy because the Node::Param objects in the Node::Sig object, and the temporary Node::Param object created for each line of an INPUT block, aren't yet unified. Commit: afb8d7951ad771db2c8c618af4c8263bc749d987 https://github.com/Perl/perl5/commit/afb8d7951ad771db2c8c618af4c8263bc749d987 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: tweak THIS/CLASS test code Make the test code take an array ref of XSUB code lines rather than just two fixed lines. This doesn't change the current test functionality, but helps generalise it so it can shortly be extracted out as a general test sub. Commit: 3f428860e912395df2598048486f6894e0e436d2 https://github.com/Perl/perl5/commit/3f428860e912395df2598048486f6894e0e436d2 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: t/001-basic.t: add test_many() sub Factor out the recently-added test loop for testing THIS/CLASS into a more generalised "test multiple XSUBs against lists of regexes" test sub. Commit: 87072642f37c77f27612908e42cdc1f0c097dac1 https://github.com/Perl/perl5/commit/87072642f37c77f27612908e42cdc1f0c097dac1 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: add Node::Sig::usage_string() method. Previously, to generate the string to output as C code like croak_xs_usage(cv, "a, b,c = 0") the code used a lexical var, @report_params, to build up a list of parameter names, such as ('a', 'c = 0') etc, as the parameters were processed. This commit gets rid of @report_params, and instead adds a new method, ExtUtils::ParseXS::Node::Sig::usage_string() which examines the list of parameters stored in the Sig object and deduces the usage string from that. This is part of gradually moving towards a "build an AST *then* output stuff based on that tree" model. Commit: c41900f3b8f23105a11032ab636ce3d2c132c3b8 https://github.com/Perl/perl5/commit/c41900f3b8f23105a11032ab636ce3d2c132c3b8 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M MANIFEST M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm M dist/ExtUtils-ParseXS/t/001-basic.t R dist/ExtUtils-ParseXS/t/110-assign_func_args.t Log Message: ----------- ParseXS: reimplement autocall arg calculation. This commit changes how the argument string is generated which is output as part of an autocall to a C function. In particular: - it deletes the ExtUtils::ParseXS::Utilities::C_func_signature() method; - it deletes the test file t/110-assign_func_args.t which exercised that method; - it adds a method called ExtUtils::ParseXS::Node::Sig::C_func_signature() which serves a similar purpose as the removed method, but in a different and more robust way; - it adds several tests to t/001-basic.t which provide similar coverage to the deleted tests. The former way of generating the arg string worked by: during XSUB signature processing, a list of candidate arg names was accumulated, then joined and stored as $self->{xsub_C_auto_function_signature} by C_func_signature(), which handled OUT params and skipped any fake THIS/CLASS arg. Then, If a C_ARGS keyword was then encountered, that would overwrite the xsub_C_auto_function_signature string. Then when INPUT lines were processed, any var declared as '&foo' would cause something like this to be done: $self->{xsub_C_auto_function_signature} =~ s/\bfoo\b/&foo/. This was not robust and could modify the C_ARGS overridden string. The new method instead scans the parameter list in the Node::Sig object and builds the argument list from that *at the time it is needed*. Any C_ARGS value is saved and used as an override. In principle there are no functional changes, apart from bug fixes and the deleting of a "not for public use" method. Commit: 48b29c993d9d2b551ee0f6a9b693a48639ddb491 https://github.com/Perl/perl5/commit/48b29c993d9d2b551ee0f6a9b693a48639ddb491 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: add more tests for OUTLIST etc Add tests that all the IN/OUT/IN_OUTLIST etc permutations generate plausible code Commit: e3694506e153d279a45727352b8885985153139d https://github.com/Perl/perl5/commit/e3694506e153d279a45727352b8885985153139d Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: remove @ANSI_params var Now that *all* XSUB parameters are stored as a list of Node::Param objects - not just ANSI ones - there's no longer a need to keep a list of the ANSI ones; instead, just 'grep $_->{is_ansi} all the params' to get the needed ones. Should be no functional changes. Commit: 3ed0dcc90160b56e110afb622aae1c4611c4d4e1 https://github.com/Perl/perl5/commit/3ed0dcc90160b56e110afb622aae1c4611c4d4e1 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: remove @OUTLIST_vars Rather than pushing param names into an array if the XSUB signature declares them as 'OUTLIST' or 'IN_OUTLIST', just grep for such params within the list of Node::Param objects as needed. Should be no functional changes. Commit: 3979ee2e1decbdf4f0ccc8a181d222395486a03a https://github.com/Perl/perl5/commit/3979ee2e1decbdf4f0ccc8a181d222395486a03a Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: t/001-basic.t: tweak test_many() On the convenience test function test_many(), make the arg which trims away all generated output except the matching function(s) a bit more flexible, so that in the next commit, it can be used to extract a boot function instead of regular function. Commit: 9f7bfc84ce43d94cc0b7ffc0f0f0350e4c988856 https://github.com/Perl/perl5/commit/9f7bfc84ce43d94cc0b7ffc0f0f0350e4c988856 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: refactor prototype generation This commit: - eliminates the $self->{xsub_map_arg_idx_to_proto} fields, and in keeping with similar recent comments, instead generates the XSUB's proto string when needed by scanning the list of params in the Node::Sig object. - adds a Node::Sig method, proto_string(), to do that. - Adds lots of tests of XSUB prototype strings. - Adds a 'proto' field to Node::Param objects to store the prototype char(s) for that parameter if it's been overridden by the typemap (the override is actually broken, and always has been; see the next commit for the fix). - Finishes off removing the second signature args processing loop, which the last several commits have been aiming for. - Moves arg count and min arg count state into the Node::Sig object. - Eliminates the no-longer-needed %only_C_inlist var. This commit may well change the generation of XSUB prototype strings in edge cases - if so, then hopefully for the better. Commit: 66d44d629cbf83d0e7a2280b1c5b278e4ca4f4a6 https://github.com/Perl/perl5/commit/66d44d629cbf83d0e7a2280b1c5b278e4ca4f4a6 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: fix overridden prototype char(s) There is supported syntax in typemaps to specify a sub prototype value for a parameter, to override the default of '$'. This is done using an optional third field in the TYPEMAP section of a typemap file. For example: Foo* T_FOO \[@%] However, due to a thinko in the typemap parser code (using 'proto' rather than 'prototype' as one of the args to a ExtUtils::Typemaps::Type->new() method call), this overridden value has always been silently ignored. And there were no tests for it. This commit fixes that and adds tests. In the usual case where there is no override, the original intent of the Typemap parser code was to add '$' as the proto value. Due to the bug, this was never added, and ExtUtils::Typemaps::Type objects generally had no proto field. This commit diverges from the original intent and keeps the proto field undefined rather than setting it to '$', because there are several tests which check that a regenerated typemap looks like it expects, and they were all suddenly failing due to a sudden '$' appearing on the regenerated typemap line. In addition, in the XS parser, the overridden value as returned by the typemap parser, was being emitted as-is into the generated C code within a double-quoted string. For example, a three-parameter XSUB with an overridden first parameter type, as in the example above, would generate C code along the lines of: newXSproto_portable(..., "\[@%]$$") and the backslash would get removed by the C compiler. So this commit also causes backslashes be escaped before emitting the C code: newXSproto_portable(..., "\\[@%]$$") Commit: 98386d1c5ef40e7fa5e80b6fa97e3f9c4519d8de https://github.com/Perl/perl5/commit/98386d1c5ef40e7fa5e80b6fa97e3f9c4519d8de Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: reindent arg-processing code Slightly widen the scope of a {...} block which encloses most of the arg-splitting/processing code so that the block now encompasses *all* the code, then re-indent the 'for (@args)' block within it, which was was one indent too much due to earlier code refactoring. Apart from the slight scope tweak, whitespace-only. Commit: f09d72cfd8b839c7ab5a2d63bf93193f2a456d5f https://github.com/Perl/perl5/commit/f09d72cfd8b839c7ab5a2d63bf93193f2a456d5f Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: tidy up sig-processing code comments after heavy refactoring, make the code comments concerning parsing the XSUB signature and its parameters reflect the new reality Commit: 9c24c4ed296e47f779de18de08644673635cc3fd https://github.com/Perl/perl5/commit/9c24c4ed296e47f779de18de08644673635cc3fd Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: rm {xsub_map_argname_to_type} Eliminate the xsub_map_argname_to_type field of ExtUtils::ParseXS objects. Instead, now that they exist, get the type value from the relevant Node::Param object within the Node::Sig object. Commit: b85d5f8f01ec574b78c107a7b32460e3c4df46e6 https://github.com/Perl/perl5/commit/b85d5f8f01ec574b78c107a7b32460e3c4df46e6 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: refactor: rm soft_type Node:Param field The 'soft_type' field was added by me about 13 commits ago to get round issues where a TYPE/CLASS param's type is being defined both implicitly (by having the XSUB function name include a class) and explicitly in an INPUT line. Further refactoring since then has made the field unnecessary, and so this commit removed it and just uses the 'type' field of Node::Param always. Also add some more tests for dup THIS/CLASS. There were already tests for a dup in an INPUT line, but not in the signature. Commit: ac6d8399a53ba3234073e911f2435158c1da43e0 https://github.com/Perl/perl5/commit/ac6d8399a53ba3234073e911f2435158c1da43e0 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: rm xsub_map_varname_to_seen_in_INPUT More refactoring: remove the xsub_map_varname_to_seen_in_INPUT field from the ExtUtils::ParseXS class and instead add an in_input field to the ExtUtils::ParseXS::Node::Param class. Commit: 2fbf3694b3437ac2be6c7d1b09d89fcf9c040ec3 https://github.com/Perl/perl5/commit/2fbf3694b3437ac2be6c7d1b09d89fcf9c040ec3 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: refactor: unify sig and INPUT params The series of approx 45 refactoring commits in this branch have added E::P::Node::Param and E::P::Node:Sig objects, to allow an XSUB's signature to be stored as a list of Param objects in a Sig object. So in a straightforward XSUB like: int foo(a, b = 999) int a int b a pair of Param objects is created and stored in a Sig object to represent the two items in the signature, e.g. { var => 'a', arg_num => 1 }, { var => 'b', arg_num => 2, default => 999 }, But up until now, when the lines in the implicit INPUT section were subsequently parsed, a *second* pair of temporary Param objects were created using both data obtained from the Sig objects and from the INPUT line. The as_code() method was then called on each temp Param object, and the temp object was then thrown away. This commit changes it so that instead, any extra info obtained from an INPUT line is added to the original Param object in the Sig object, (e.g. the 'type' value) and the as_code() method is called on the *original* object. No temporary Param objects are created. This commit is effectively what the previous chain of commits have been preparing for. Before that, all info obtained from the signature was stored in a series of hash refs stored in the ExtUtils::ParseXS object, such as $self->{sub_map_argname_to_default}{b} = 999; The new way is cleaner, conceptually simpler, gathers related code and data into one location, and has fewer special cases that need handling. The main thing it doesn't do yet is defer code generation. It still emits a C var declaration directly after each INPUT line is read and parsed. Eventually I would like for the whole signature/INPUT sequence to be read in and parsed and *then* emit all the code one go (and in the long term, to read in the *whole* XS file before emitting any code). One intended side effect of this commit is that it now detects duplicate 'alien' parameters again - this was broken during the earlier refactoring. An alien param is one declared in INPUT but not in the signature: int foo(a) int a # normal parameter int b # alien parameter int b # duplicate alien parameter A test has been added for this. A test has also been added for looking up the prototype char associated with a type when the type can change, as with a synthetic parameter like THIS. Commit: 05c2d6d4850035b38512436ddb35901c80fc7230 https://github.com/Perl/perl5/commit/05c2d6d4850035b38512436ddb35901c80fc7230 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- parseXS: refactor: INPUT_handler() init parsing Simplify a complex series of nested if/elses and update code comments. Should be no functional changes. Commit: 3ee6057ce07260d07db4acb12955ad426b086e5e https://github.com/Perl/perl5/commit/3ee6057ce07260d07db4acb12955ad426b086e5e Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: simplify length(foo) handling Currently, the pseudo-parameter 'length(foo)' is handled by creating a Node::Param object with a 'var' field value of 'XSauto_length_of_foo', while that object is then added to the $sig->{names} object using a key of 'foo'. This commit removes that inconsistency and makes both use 'length(foo)'. This shouldn't (in theory) change the what C code is emitted for the 'STRLEN XSauto_length_of_foo = ...' declaration etc, but might (in principle) change for (better or worse) the detection of errors for things like duplicate var declarations if someone includes 'XSauto_length_of_foo' in an INPUT line. I'm not worrying about it too much as the way such C code is generated will be changed soon. Commit: ffc0f1ab72dbc632f29ef2d00213a872f27703c7 https://github.com/Perl/perl5/commit/ffc0f1ab72dbc632f29ef2d00213a872f27703c7 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: rename $name_or_lenname Rename this long lex var to just '$name' now that the code is simpler and there is less need to distinguish between various name variants. Commit: 88f0de5c0a4308310afe3c9c36d25968ebf860e5 https://github.com/Perl/perl5/commit/88f0de5c0a4308310afe3c9c36d25968ebf860e5 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: test for OUT in one place Currently there is code in both the signature parsing code and in the INPUT parsing code which sets no_init if the IN/OUT/etc parameter modifier matches /^OUT/. This commit makes it check only during signature parsing, which simplifies the code slightly. Should be no functional changes. Commit: effafc618dc161c8cc071b9d0b41a79c600310cd https://github.com/Perl/perl5/commit/effafc618dc161c8cc071b9d0b41a79c600310cd Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: sort Node::Param fields Sort the field declaration lines for E::P::Node::Param into a more logical order. Commit: 2a2fb53c874b9ef4705c4e3cfa134016938e94d6 https://github.com/Perl/perl5/commit/2a2fb53c874b9ef4705c4e3cfa134016938e94d6 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: move sig parsing code into fn Move the 200 or so lines of code which splits and parses an XSUB's signature out from process_file() and into its own method. This commit changes as little as possible: apart from adding a method declaration and call, the main body of the code has just been cut and pasted as-is, apart from reducing the indentation. The next few commits will change and move the code so that it becomes a method of ExtUtils::ParseXS::Node::Sig rather than of ExtUtils::ParseXS. Commit: d14e0cb7fd26db69d530a06115120401f07e0f76 https://github.com/Perl/perl5/commit/d14e0cb7fd26db69d530a06115120401f07e0f76 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm Log Message: ----------- ParseXS: refactor: make parse_sig a Node::Sig meth The previous commit moved the signature parsing code into its own method. This commit makes the method be in the Extutils::ParseXS::Node::Sig class. This involves changing the name to just 'parse', and swapping around all the mentions of $self and $sig. The next commit will move the method into Node.pm. (By doing this in 3 commits, code changes don't get hidden in the noise). Commit: c4a0b1ec171c204fa09fe3e1a521bafbe43d76a4 https://github.com/Perl/perl5/commit/c4a0b1ec171c204fa09fe3e1a521bafbe43d76a4 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: move Sig::parse() into Node.pm The previous two commits have moved the signature parsing code into its own sub and made it a method of Extutils::ParseXS::Node::Sig. This commit moves the body of the method into Node.pm. There are no changes to the method's code apart from no longer needing to fully qualify the method name in the declaration. This commit also moves the our ($C_group_rex, $C_arg) var definitions from ParseXS.pm to Node.pm, as they're only used to hold regexes used to split the parameters in the signature. They've also been changed from 'our' to 'my'. Commit: a9182b60beab8a988466624be20e8a81759c9c2d https://github.com/Perl/perl5/commit/a9182b60beab8a988466624be20e8a81759c9c2d Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: Sig::parse(): rename arg vars This method splits the XSUB signature string into individual parameter strings and then parses them. Rename the var from '@args' to '@param_texts' since it contains parameters rather than args. The _text suffix is to distinguish them from $param objects. This is one of the last steps in my quiet mission to rename variables etc from *arg* to *param* where they hold info about params rather than args. This is particularly significant as some parameters (like 'length(foo)') don't get bound to args, so there isn't a 1:1 correspondence. Also, shorten the names of a couple of lex vars now that they're only in a small method with limited scope: $args_count => $nargs $optional_args_count => $opt_args Should be no functional changes. Commit: f2d49d091e7ff9b294a06050816f54d36444c9cf https://github.com/Perl/perl5/commit/f2d49d091e7ff9b294a06050816f54d36444c9cf Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: change error msgs argument => parameter Several error messages complain about things like "duplicate argument" when they mean "duplicate parameter". So update these messages to be more accurate. Commit: b9e0717e9fc2519c3cc68c77953340329eb7c382 https://github.com/Perl/perl5/commit/b9e0717e9fc2519c3cc68c77953340329eb7c382 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/t/001-basic.t Log Message: ----------- ParseXS: 5.8.9 backcompat fixes A couple of fixes to make it build+test under 5.8.9. The grep expression exists $_->{in_out} && $_->{in_out} =~ /OUT$/ was wrong - it should have been defined rather than exists, as is done elsewhere. I'm not sure why an 'uninit var' warning only appeared on 5.8.9 but not blead - perhaps some minor autovivification difference? It was also warning $ExtUtils::ParseXS::DIE_ON_ERROR only used once $ExtUtils::ParseXS::AUTHOR_WARNINGS only used once in t/001-basic.t because that test file only loads ExtUtils::ParseXS at runtime. Again, I'm not sure why it didn't warn on blead too. But I made the var initialisations more robust against 'once' warnings anyway by using 'our'. Commit: 0a291b54c77c09c18b90a426e2e573a58916ed22 https://github.com/Perl/perl5/commit/0a291b54c77c09c18b90a426e2e573a58916ed22 Author: David Mitchell <da...@iabyn.com> Date: 2024-10-18 (Fri, 18 Oct 2024) Changed paths: M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm Log Message: ----------- ParseXS: refactor: simplify require fields require 'fields.pm' can be written more simply as require fields They compile to the same optree. Compare: https://github.com/Perl/perl5/compare/d52927ad6d75...0a291b54c77c To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications