Skip to content

Commit 807b4b7

Browse files
build: work around GCC optimizer bug for aarch64
1 parent 3dc3818 commit 807b4b7

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

.github/workflows/pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
CIBW_ARCHS: ${{matrix.cibw_arch}}
5050
CIBW_SKIP: "*-musllinux_aarch64"
5151
# FIXME: stop skipping when the tests stop crashing
52-
CIBW_TEST_SKIP: "*-win_* *linux_aarch64"
52+
CIBW_TEST_SKIP: "*-win_*"
5353
- name: Upload wheels
5454
uses: actions/upload-artifact@v4
5555
with:

setup.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
from sys import platform
1+
from os import name as os_name
2+
from platform import machine
23

34
from setuptools import Extension, setup # type: ignore
45

6+
if os_name != "nt":
7+
cflags = [
8+
"-std=c11",
9+
"-fvisibility=hidden",
10+
"-Wno-cast-function-type",
11+
"-Werror=implicit-function-declaration",
12+
]
13+
# FIXME: GCC optimizer bug workaround for #330 & #386
14+
if machine().startswith("aarch64"):
15+
cflags.append("--param=early-inlining-insns=9")
16+
else:
17+
cflags = ["/std:c11", "/wd4244"]
18+
519
setup(
620
packages=["tree_sitter"],
721
include_package_data=False,
@@ -36,18 +50,7 @@
3650
("PY_SSIZE_T_CLEAN", None),
3751
("TREE_SITTER_HIDE_SYMBOLS", None),
3852
],
39-
undef_macros=[
40-
"TREE_SITTER_FEATURE_WASM",
41-
],
42-
extra_compile_args=[
43-
"-std=c11",
44-
"-fvisibility=hidden",
45-
"-Wno-cast-function-type",
46-
"-Werror=implicit-function-declaration",
47-
] if platform != "win32" else [
48-
"/std:c11",
49-
"/wd4244",
50-
],
53+
extra_compile_args=cflags,
5154
)
5255
],
5356
)

0 commit comments

Comments
 (0)