Fix avoid linking libpcre when unused#14891
Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom Aug 14, 2024
Merged
Fix avoid linking libpcre when unused#14891straight-shoota merged 1 commit intocrystal-lang:masterfrom
libpcre when unused#14891straight-shoota merged 1 commit intocrystal-lang:masterfrom
Conversation
Collaborator
|
This pull request has been mentioned on Crystal Forum. There might be relevant details there: |
straight-shoota
approved these changes
Aug 12, 2024
HertzDevil
approved these changes
Aug 12, 2024
libpcre when unused
Collaborator
|
Good catch! One difference is that instead of being allocated by the runtime when the application is starting (before concurrency & parallelism have started) it will now be lazily generated on demand. It's thus possible that it will be called from 2 threads at the same time. In this specific case, the worst that can happen is that they both generate & store the version number. Another difference is that instead of being a Both aren't an issue for this specific case. |
ysbaddaden
approved these changes
Aug 13, 2024
libpcre when unusedlibpcre when unused
1 task
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As reported by galapagdos on the Crystal forum, crystal always links libpcre/libpcre2 even if you don not use regular expressions, and calls the function
pcre2_config_8.crystal build hello_world.cr ldd hello_world # libpcre2 is linked even if regular expressions are not usedThis occurs because
beginis used inclass_getterin the Regex::PCRE module (src/regex/pcre.cr).I searched the Crystal code with grep command and could not find any other uses of
begininclass_getters.supplement
According to
crystal tool expand, the macro is expanded as below.Before:
After:
Could you please review if it's ok not to use
beginhere?Thank you.
Resolves #5379