-
Notifications
You must be signed in to change notification settings - Fork 603
make_ext.pl: eliminate fatal use of 'goto LABEL' #24019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jkeenan
wants to merge
11
commits into
Perl:blead
Choose a base branch
from
jkeenan:make_ext-no-goto-20251220
base: blead
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+384
−329
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This eliminates the now fatalized use of
goto LABELdiscussed 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.