diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2023-05-20 21:53:33 -0400 |
---|---|---|
committer | Randy Eckenrode <randy@largeandhighquality.com> | 2023-05-29 20:27:53 -0400 |
commit | 0b499eb86239cae23e52ba7c8ad2c3d30e6ed5b8 (patch) | |
tree | ad4115b09b213c9ca415058504d20c8c239db745 /pkgs/development/python-modules/cffi | |
parent | 5611fa71ab437f0be9fda35cdeb47df6fdc40659 (diff) |
python3Packages.cffi: fix build with newer clang
cffi uses a technique to find the offset of a struct that causes newer clangs to issue a warning regarding null pointer subtraction. This patch silences the warning, so cffi can build.
Diffstat (limited to 'pkgs/development/python-modules/cffi')
-rw-r--r-- | pkgs/development/python-modules/cffi/clang-pointer-substraction-warning.diff | 11 | ||||
-rw-r--r-- | pkgs/development/python-modules/cffi/default.nix | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/cffi/clang-pointer-substraction-warning.diff b/pkgs/development/python-modules/cffi/clang-pointer-substraction-warning.diff new file mode 100644 index 0000000000000..75b2677e380e7 --- /dev/null +++ b/pkgs/development/python-modules/cffi/clang-pointer-substraction-warning.diff @@ -0,0 +1,11 @@ +diff -r c649a735cf82 testing/support.py +--- a/testing/support.py Thu Feb 23 05:42:01 2023 +0100 ++++ b/testing/support.py Sat May 20 21:46:56 2023 -0400 +@@ -112,6 +112,7 @@ + '-Wno-unreachable-code'] + # special things for clang + extra_compile_args.append('-Qunused-arguments') ++ extra_compile_args.append('-Wno-null-pointer-subtraction') + else: + # assume a standard gcc + extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion', diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix index 5d3e220e98de0..0d93941b974d5 100644 --- a/pkgs/development/python-modules/cffi/default.nix +++ b/pkgs/development/python-modules/cffi/default.nix @@ -50,6 +50,12 @@ if isPyPy then null else buildPythonPackage rec { ]; hash = "sha256-+2daRTvxtyrCPimOEAmVbiVm1Bso9hxGbaAbd03E+ws="; }) + ] ++ lib.optionals (stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc) "13") [ + # -Wnull-pointer-subtraction is enabled with -Wextra. Suppress it to allow the following tests + # to run and pass when cffi is built with newer versions of clang: + # - testing/cffi1/test_verify1.py::test_enum_usage + # - testing/cffi1/test_verify1.py::test_named_pointer_as_argument + ./clang-pointer-substraction-warning.diff ] ++ lib.optionals (pythonAtLeast "3.11") [ # Fix test that failed because python seems to have changed the exception format in the # final release. This patch should be included in the next version and can be removed when |