Skip to content

Conversation

@jkeenan
Copy link
Contributor

@jkeenan jkeenan commented Dec 20, 2025

This eliminates the now fatalized use of goto LABEL discussed in GH #24015.

To accomplish this I had to do close study of a 300-line-plus subroutine whose code was badly in need of some tidying. So the first few commits here did that. Then, to understand the code better, I began to refactor that subroutine from the bottom up. That eventually gave me a clue as to how the ultimate fix would actually work. The next-to-last commit makes that fix; the final commit does a little bit more tidying.


  • This set of changes does not require a perldelta entry.

We'll need to do some refactoring and re-arranging of code in
make_ext.pl to address GH Perl#24014.  That will be easier to do if we tidy
up the code inside sub build_extension():  300+ lines with a mixture of
hard tabs and whitespace for leading indents.  However, for the time
being we won't do additional tidying (e.g., uncuddling else's) because
that would change line numbers.
We're going to be shifting a lot of code around during refactoring.  So
let's grant ourselves the flexibility of indented here-docs.
We had both @pass_through and $pass_through, the latter being an array
ref -- but not one holding the same exact list as @pass_through!  Let's
disambiguate them (a little) by renaming the latter to $pass_through_ref
(at least within the scope of sub build_extension()).
We take the code that was previously within the scope of the NO_MAKEFILE
label and place it in its own subroutine.

Two of the newly created internal functions, _use_Makefile_PL() and
_is_unix(), will now be called from within _internal_build_extension()
rather than directly from build_extension().

Two of the four possible places at which build_extension could
previously return -- thereby triggering progression to the next module
to be built in sequence -- now fall within the scope of
_internal_build_extension().  These have to be a "hard return," i.e.,
they have to return an undefined value.  At the point at which they are
called from within build_extension(), we now capture that (undefined)
return value and say 'return unless defined $rv;' in order to return
from build_extension() and proceed to the next module's processing.
This is the commit at which we finally solve the problem discussed in
Perl#24015.  We replace the 'goto' call
with a call of _internal_build_extension() with the same arguments we
are already using in the standard cases.

Can be verified by configuring and running make test_prep, mangling
dist/Data-Dumper/Makefile to change the value of 'XS_VERSION' -- which
previously (at least in a post-d306795336 world) would have caused a
build failure -- then re-run 'make test_prep' which, during the rebuild,
will generate a new, corrected dist/Data-Dumper/Makefile and run to
completion.
Earlier in this pull request we tidied up leading whitespace and
uncuddled else's, but only in the parts of the file that we were
planning to revise.  At this point, we can do some common-sense tidying
in the remaining parts of the file.

We leave a hard tab in one case where it's illustrating a 'make' command.  Get indents in better shape
(though leaving some else's uncuddled unchanged where that's more readable).
@jkeenan jkeenan added Infrastructure Things needed to maintain Perl development goto-partial-fatalization labels Dec 20, 2025
@jkeenan jkeenan changed the title Make ext no goto 20251220 make_ext.pl: eliminate fatal use of 'goto LABEL' Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goto-partial-fatalization Infrastructure Things needed to maintain Perl development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants