diff options
| author | Khem Raj <raj.khem@gmail.com> | 2025-02-04 14:09:30 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-11 11:44:19 +0000 |
| commit | 0bf496f24b4b994cff87ee73977ce6acd9cd8d45 (patch) | |
| tree | 0cba4c2e1079e3d03f756f08d23e9e7c2692c0ef /meta/recipes-devtools/python | |
| parent | 31a537d12441e4bcaf3f15e7807a5092ee61d7f1 (diff) | |
| download | poky-0bf496f24b4b994cff87ee73977ce6acd9cd8d45.tar.gz | |
python3-cffi: Fix failing ptests with clang
Clang finds additional warnings with cffi generated code
_CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:587:10: error: non-constant-expression cannot be narrowed from type 'long' to 'size_t' (ak│a 'unsigned long') in initializer list [-Wc++11-narrowing]
(From OE-Core rev: 470edc62b1821bcbb679bd3822acd98e9996c9e7)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python')
| -rw-r--r-- | meta/recipes-devtools/python/python3-cffi/0001-Cast-offset-to-size_t-to-avoid-c-11-narrowing-warnin.patch | 34 | ||||
| -rw-r--r-- | meta/recipes-devtools/python/python3-cffi_1.17.1.bb | 3 |
2 files changed, 36 insertions, 1 deletions
diff --git a/meta/recipes-devtools/python/python3-cffi/0001-Cast-offset-to-size_t-to-avoid-c-11-narrowing-warnin.patch b/meta/recipes-devtools/python/python3-cffi/0001-Cast-offset-to-size_t-to-avoid-c-11-narrowing-warnin.patch new file mode 100644 index 0000000000..a919f4f6fb --- /dev/null +++ b/meta/recipes-devtools/python/python3-cffi/0001-Cast-offset-to-size_t-to-avoid-c-11-narrowing-warnin.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From 2ac63f8765e62f1492ef3ee06791636700bc6cfb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: triallax <triallax@tutanota.com> | ||
| 3 | Date: Sat, 29 Jun 2024 15:25:24 +0100 | ||
| 4 | Subject: [PATCH] Cast offset to size_t to avoid c++11-narrowing warning (#92) | ||
| 5 | |||
| 6 | e.g. with clang 18 on chimera linux: | ||
| 7 | |||
| 8 | _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] | ||
| 9 | 583 | { "a", ((char *)&((foo_t)4096)->a) - (char *)4096, | ||
| 10 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 11 | _CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: note: insert an explicit cast to silence this issue | ||
| 12 | 583 | { "a", ((char *)&((foo_t)4096)->a) - (char *)4096, | ||
| 13 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 14 | | static_cast<size_t>( ) | ||
| 15 | |||
| 16 | Upstream-Status: Backport [https://github.com/python-cffi/cffi/pull/92] | ||
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 18 | --- | ||
| 19 | src/cffi/recompiler.py | 2 +- | ||
| 20 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 21 | |||
| 22 | diff --git a/src/cffi/recompiler.py b/src/cffi/recompiler.py | ||
| 23 | index ac6c163e..14d578ee 100644 | ||
| 24 | --- a/src/cffi/recompiler.py | ||
| 25 | +++ b/src/cffi/recompiler.py | ||
| 26 | @@ -953,7 +953,7 @@ class Recompiler: | ||
| 27 | if cname is None or fbitsize >= 0: | ||
| 28 | offset = '(size_t)-1' | ||
| 29 | elif named_ptr is not None: | ||
| 30 | - offset = '((char *)&((%s)4096)->%s) - (char *)4096' % ( | ||
| 31 | + offset = '(size_t)(((char *)&((%s)4096)->%s) - (char *)4096)' % ( | ||
| 32 | named_ptr.name, fldname) | ||
| 33 | else: | ||
| 34 | offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname) | ||
diff --git a/meta/recipes-devtools/python/python3-cffi_1.17.1.bb b/meta/recipes-devtools/python/python3-cffi_1.17.1.bb index fbe9051a90..5a3af03d9f 100644 --- a/meta/recipes-devtools/python/python3-cffi_1.17.1.bb +++ b/meta/recipes-devtools/python/python3-cffi_1.17.1.bb | |||
| @@ -6,7 +6,8 @@ DEPENDS += "libffi python3-pycparser" | |||
| 6 | 6 | ||
| 7 | SRC_URI[sha256sum] = "1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824" | 7 | SRC_URI[sha256sum] = "1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824" |
| 8 | 8 | ||
| 9 | SRC_URI += "file://run-ptest" | 9 | SRC_URI += "file://run-ptest \ |
| 10 | file://0001-Cast-offset-to-size_t-to-avoid-c-11-narrowing-warnin.patch" | ||
| 10 | 11 | ||
| 11 | inherit pypi python_setuptools_build_meta ptest pkgconfig | 12 | inherit pypi python_setuptools_build_meta ptest pkgconfig |
| 12 | 13 | ||
