Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions main/python-cffi/patches/clang-errors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Based on https://github.com/python-cffi/cffi/pull/78, but also performing a cast
to size_t to avoid errors like:

_CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: error: non-constant-expression cannot be narrowed from type 'long' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
583 | { "a", ((char *)&((foo_t)4096)->a) - (char *)4096,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: note: insert an explicit cast to silence this issue
583 | { "a", ((char *)&((foo_t)4096)->a) - (char *)4096,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| static_cast<size_t>( )

diff --git a/src/cffi/recompiler.py b/src/cffi/recompiler.py
index 4167bc05..ac6c163e 100644
--- a/src/cffi/recompiler.py
+++ b/src/cffi/recompiler.py
@@ -953,7 +953,7 @@ def _struct_ctx(self, tp, cname, approxname, named_ptr=None):
if cname is None or fbitsize >= 0:
offset = '(size_t)-1'
elif named_ptr is not None:
- offset = '((char *)&((%s)0)->%s) - (char *)0' % (
+ offset = '(size_t)(((char *)&((%s)4096)->%s) - (char *)4096)' % (
named_ptr.name, fldname)
else:
offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname)
8 changes: 3 additions & 5 deletions main/python-cffi/template.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pkgname = "python-cffi"
pkgver = "1.16.0"
pkgrel = 1
pkgrel = 2
build_style = "python_pep517"
hostmakedepends = [
"libffi-devel",
"python-build",
"python-installer",
"python-setuptools",
"python-wheel",
"libffi-devel",
]
makedepends = ["python-devel", "libffi-devel"]
makedepends = ["libffi-devel", "python-devel"]
depends = ["python-pycparser"]
checkdepends = ["python-pycparser", "python-pytest"]
pkgdesc = "C FFI for Python"
Expand All @@ -18,8 +18,6 @@
url = "https://cffi.readthedocs.io"
source = f"$(PYPI_SITE)/c/cffi/cffi-{pkgver}.tar.gz"
sha256 = "bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0"
# do_check needs fixing up more
options = ["!check"]


def post_install(self):
Expand Down