Skip to content

Comments

Fix llvm19 builds#76

Merged
chrzaszcz merged 2 commits intomasterfrom
fix_llvm19
Apr 10, 2025
Merged

Fix llvm19 builds#76
chrzaszcz merged 2 commits intomasterfrom
fix_llvm19

Conversation

@NelsonVides
Copy link
Collaborator

@NelsonVides NelsonVides commented Apr 10, 2025

See https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals:

The base template for std::char_traits has been removed in LLVM 19. If you are using std::char_traits with types other than char, wchar_t, char8_t, char16_t, char32_t or a custom character type for which you specialized std::char_traits, your code will stop working. The Standard does not mandate that a base template is provided, and such a base template is bound to be incorrect for some types, which could currently cause unexpected behavior while going undetected.

Then

using ustring = std::basic_string<unsigned char>;

using ustring = std::basic_string<unsigned char>;
That unsigned char is not a valid char_traits and will fail to compile. C++20 came up with a new type called char8_t which is undefined behaviour to cast to unsigned char because "dealing with UTF8 encoding safely is hard", so it broke backwards compatibility.

But OTP uses unsigned char for everything binaries, and it is undefined behaviour to convert from one to the other in C++.

Hence exml breaks under LLVM 19, that is, XCode 16.3, that is, the update apple release this week.

This PR fixes it by simply using a vector of unsigned chars instead of the basic_string. Theoretically the basic string is a lighter-weight abstraction but I doubt the compiler wouldn't know how to optimise that.

This PR also removes some unused variables.

See https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals:
> The base template for std::char_traits has been removed in LLVM 19. If
> you are using std::char_traits with types other than char, wchar_t,
> char8_t, char16_t, char32_t or a custom character type for which you
> specialized std::char_traits, your code will stop working. The Standard
> does not mandate that a base template is provided, and such a base
> template is bound to be incorrect for some types, which could currently
> cause unexpected behavior while going undetected.
@NelsonVides NelsonVides self-assigned this Apr 10, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.94%. Comparing base (3f63a63) to head (e050d60).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
- Coverage   74.07%   73.94%   -0.13%     
==========================================
  Files           7        7              
  Lines        1192     1190       -2     
  Branches      169      169              
==========================================
- Hits          883      880       -3     
- Misses        309      310       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NelsonVides NelsonVides requested a review from chrzaszcz April 10, 2025 07:02
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@chrzaszcz chrzaszcz merged commit 33cae8d into master Apr 10, 2025
3 checks passed
@chrzaszcz chrzaszcz deleted the fix_llvm19 branch April 10, 2025 07:50
This was referenced Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants