Actually use utf8cpp after building it #3354
Closed
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.
I've been trying to raise this utf8cpp problem with the antlr4 team in #3200 and #3280, so far with little luck. So I'm filing this PR as a potential resolution in the hope of moving forward.
Right now, as far as I can tell, the antlr4 build process always either ensures utf8cpp is present on the system or downloads and builds utf8cpp. It then doesn't use utf8cpp by default. This makes little sense. It should either
This PR is an attempt to implement option 1.
Note that
StringUtils.h
is included by parser implementations. This means that if it includesutf8.h
then every parser implementation must have utf8cpp's include files in its include path. Given how the runtime is built and used this seems like a huge mess. Accordingly, I de-templatizedutf32_to_utf8()
(the generality wasn't needed) and moved both it andutf8_to_utf32()
down intoStringUtils.cpp
.Obviously I don't know why the code got into the state it did or the full implications of moving to default use of utf8cpp. However, if something like this PR doesn't make sense then there should be an alternative PR to turn off the utf8cpp find/download unless it's going to be used.
@mike-lischke Please take a look at this. Once this issue is resolved I'll have a better idea of what to do about #3200 and I may submit a PR for #3280.