Skip to content

Fix build and tests on alternative architectures #1692

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

Merged
merged 3 commits into from
Apr 3, 2022
Merged

Fix build and tests on alternative architectures #1692

merged 3 commits into from
Apr 3, 2022

Conversation

alebastr
Copy link
Contributor

@alebastr alebastr commented Mar 26, 2022

Fix build and most of the tests on aarch64, ppc64le and s390x (big-endian).

Note: this is a minimal set of changes just to make things compile and tests pass. There are more mismatched types, but none of those break the build or affect the ABI. Case in point: tags/include/tree_sitter/tags.h doesn't have a single uint8_t parameter, while there's a plenty of u8s in the rust counterpart of the code.

There's one remaining test failure on s390x which I didn't have enough time to debug - #1693

Fixes build on aarch64, ppc64le and other platforms that have c_char
defined as u8.
Fixes build on aarch64, ppc64le and other platforms that have c_char
defined as u8.
`*usize` -> `*u32` conversion on 64-bit big-endian machine takes high
halfword of the value. As a consequence, any result returned via
`count` is unexpectedly shifted left:

    u32   = 00 00 00 01             // 1
    usize = 00 00 00 01 00 00 00 00 // 4294967296

Fixes following test failure:
```
$ cargo test -- tests::corpus_test
<...>
running 13 tests
memory allocation of 206158430208 bytes failed
error: test failed, to rerun pass '--lib'
```
@alebastr alebastr mentioned this pull request Mar 26, 2022
@maxbrunsfeld
Copy link
Contributor

Thank you!

@maxbrunsfeld maxbrunsfeld merged commit bd3d841 into tree-sitter:master Apr 3, 2022
@alebastr alebastr deleted the alt-arch-fixes branch April 4, 2022 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants