From 68f8dd10a19f149593e3d6e079b53ad73be9e0d973b42564d1b17252cda454d8 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Mon, 30 May 2016 07:26:32 +0000 Subject: [PATCH] Accepting request 398809 from home:badshah400:branches:openSUSE:Factory:Rings:2-TestDVD Add upstream patch to actually fix problem with gcc >= 6; drop previous patch used to workaround issue. OBS-URL: https://build.opensuse.org/request/show/398809 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=29 --- cffi-1.5.2-wnoerror.patch | 13 ------- ...-cffi-avoid-bitshifting-negative-int.patch | 39 +++++++++++++++++++ python-cffi.changes | 9 +++++ python-cffi.spec | 3 +- 4 files changed, 50 insertions(+), 14 deletions(-) delete mode 100644 cffi-1.5.2-wnoerror.patch create mode 100644 python-cffi-avoid-bitshifting-negative-int.patch diff --git a/cffi-1.5.2-wnoerror.patch b/cffi-1.5.2-wnoerror.patch deleted file mode 100644 index 07fb355..0000000 --- a/cffi-1.5.2-wnoerror.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: cffi-1.5.2/testing/cffi1/test_verify1.py -=================================================================== ---- cffi-1.5.2.orig/testing/cffi1/test_verify1.py -+++ cffi-1.5.2/testing/cffi1/test_verify1.py -@@ -20,7 +20,7 @@ else: - extra_compile_args.append('-Qunused-arguments') - else: - # assume a standard gcc -- extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion'] -+ extra_compile_args = ['-Werror', '-Wno-shift-negative-value', '-Wall', '-Wextra', '-Wconversion'] - - class FFI(FFI): - error = _cffi_backend.FFI.error diff --git a/python-cffi-avoid-bitshifting-negative-int.patch b/python-cffi-avoid-bitshifting-negative-int.patch new file mode 100644 index 0000000..54bab94 --- /dev/null +++ b/python-cffi-avoid-bitshifting-negative-int.patch @@ -0,0 +1,39 @@ +# HG changeset patch +# User Armin Rigo +# Date 1464590378 -7200 +# Node ID bc14c64da0f41ba70f6fab821540b376f78e0a85 +# Parent f6d4b0a1e70b885352de186fcaeedf41365793c6 +Issue #260: don't use "x << 0" but "x | 0" to check that x is an +integer. It seems that "x << 0" is undefined, according to the C +standard, if x is any negative value... + +diff --git a/cffi/recompiler.py b/cffi/recompiler.py +--- a/cffi/recompiler.py ++++ b/cffi/recompiler.py +@@ -814,7 +814,7 @@ + try: + if ftype.is_integer_type() or fbitsize >= 0: + # accept all integers, but complain on float or double +- prnt(" (void)((p->%s) << 1); /* check that '%s.%s' is " ++ prnt(" (void)((p->%s) | 0); /* check that '%s.%s' is " + "an integer */" % (fname, cname, fname)) + continue + # only accept exactly the type declared, except that '[]' +@@ -991,7 +991,7 @@ + prnt('static int %s(unsigned long long *o)' % funcname) + prnt('{') + prnt(' int n = (%s) <= 0;' % (name,)) +- prnt(' *o = (unsigned long long)((%s) << 0);' ++ prnt(' *o = (unsigned long long)((%s) | 0);' + ' /* check that %s is an integer */' % (name, name)) + if check_value is not None: + if check_value > 0: +@@ -1250,7 +1250,7 @@ + + def _emit_bytecode_UnknownIntegerType(self, tp, index): + s = ('_cffi_prim_int(sizeof(%s), (\n' +- ' ((%s)-1) << 0 /* check that %s is an integer type */\n' ++ ' ((%s)-1) | 0 /* check that %s is an integer type */\n' + ' ) <= 0)' % (tp.name, tp.name, tp.name)) + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s) + diff --git a/python-cffi.changes b/python-cffi.changes index 106ea00..997b382 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Sun May 29 05:23:27 UTC 2016 - badshah400@gmail.com + +- Add python-cffi-avoid-bitshifting-negative-int.patch to actually + fix the "negative left shift" warning by replacing bitshifting + in appropriate places by bitwise and comparison to self; patch + taken from upstream git. Drop cffi-1.5.2-wnoerror.patch: no + longer required. + ------------------------------------------------------------------- Fri May 27 13:00:22 UTC 2016 - jmatejek@suse.com diff --git a/python-cffi.spec b/python-cffi.spec index f04f3c7..67b1d37 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -25,7 +25,8 @@ Group: Development/Languages/Python Url: http://cffi.readthedocs.org Source0: https://pypi.io/packages/source/c/cffi/cffi-%{version}.tar.gz Source1: python-cffi-rpmlintrc -Patch0: cffi-1.5.2-wnoerror.patch +# PATCH-FIX-UPSTREAM python-cffi-avoid-bitshifting-negative-int.patch boo#981848 badshah400@gmail.com -- Use bitwise AND instead of bitshifts to test for integer types; patch submitted upstream +Patch0: python-cffi-avoid-bitshifting-negative-int.patch BuildRequires: gcc-c++ BuildRequires: python-devel BuildRequires: python-setuptools