Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/cffi/files/, dev-python/cffi/
Date: Fri, 29 May 2020 08:46:25
Message-Id: 1590741957.c847df4320352b36b0e164efcf67d0ef7b37b93b.mgorny@gentoo
1 commit: c847df4320352b36b0e164efcf67d0ef7b37b93b
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 29 08:45:57 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri May 29 08:45:57 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c847df43
7
8 dev-python/cffi: Backport proper -g fix
9
10 Closes: https://bugs.gentoo.org/723476
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 ...cffi-1.14.0-r1.ebuild => cffi-1.14.0-r2.ebuild} | 0
14 dev-python/cffi/files/cffi-0.14.0-g-line.patch | 106 +++++++++++++++++++++
15 2 files changed, 106 insertions(+)
16
17 diff --git a/dev-python/cffi/cffi-1.14.0-r1.ebuild b/dev-python/cffi/cffi-1.14.0-r2.ebuild
18 similarity index 100%
19 rename from dev-python/cffi/cffi-1.14.0-r1.ebuild
20 rename to dev-python/cffi/cffi-1.14.0-r2.ebuild
21
22 diff --git a/dev-python/cffi/files/cffi-0.14.0-g-line.patch b/dev-python/cffi/files/cffi-0.14.0-g-line.patch
23 index 965f26db495..45a1099dce2 100644
24 --- a/dev-python/cffi/files/cffi-0.14.0-g-line.patch
25 +++ b/dev-python/cffi/files/cffi-0.14.0-g-line.patch
26 @@ -142,3 +142,109 @@ index 3fc3783a..5f2d7ec4 100644
27 --
28 2.26.2
29
30 +From 31249d786c833d4960bbbf4e0d7f7bcaecf92d1f Mon Sep 17 00:00:00 2001
31 +From: Armin Rigo <arigo@×××××.org>
32 +Date: Fri, 29 May 2020 10:27:40 +0200
33 +Subject: [PATCH] #454
34 +
35 +Second try with '# NUMBER' instead of '#line NUMBER', as gcc seems to output
36 +---
37 + cffi/cparser.py | 8 +++----
38 + testing/cffi0/test_parsing.py | 41 +++++++++++++++++++++++++++++++++++
39 + 2 files changed, 45 insertions(+), 4 deletions(-)
40 +
41 +diff --git a/cffi/cparser.py b/cffi/cparser.py
42 +index d9784655..74830e91 100644
43 +--- a/cffi/cparser.py
44 ++++ b/cffi/cparser.py
45 +@@ -29,7 +29,7 @@ _r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$",
46 + _r_define = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)"
47 + r"\b((?:[^\n\\]|\\.)*?)$",
48 + re.DOTALL | re.MULTILINE)
49 +-_r_line_directive = re.compile(r"^[ \t]*#[ \t]*line\b.*$", re.MULTILINE)
50 ++_r_line_directive = re.compile(r"^[ \t]*#[ \t]*(?:line|\d+)\b.*$", re.MULTILINE)
51 + _r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}")
52 + _r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$")
53 + _r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]")
54 +@@ -166,9 +166,9 @@ def _warn_for_non_extern_non_static_global_variable(decl):
55 +
56 + def _remove_line_directives(csource):
57 + # _r_line_directive matches whole lines, without the final \n, if they
58 +- # start with '#line' with some spacing allowed. This function stores
59 +- # them away and replaces them with exactly the string '#line@N', where
60 +- # N is the index in the list 'line_directives'.
61 ++ # start with '#line' with some spacing allowed, or '#NUMBER'. This
62 ++ # function stores them away and replaces them with exactly the string
63 ++ # '#line@N', where N is the index in the list 'line_directives'.
64 + line_directives = []
65 + def replace(m):
66 + i = len(line_directives)
67 +diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py
68 +index 5f2d7ec4..a5e45874 100644
69 +--- a/testing/cffi0/test_parsing.py
70 ++++ b/testing/cffi0/test_parsing.py
71 +@@ -199,6 +199,21 @@ def test_dont_remove_comment_in_line_directives():
72 +
73 + some syntax error here
74 + """)
75 ++ #
76 ++ assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax"
77 ++ ffi = FFI(backend=FakeBackend())
78 ++ e = py.test.raises(CDefError, ffi.cdef, """
79 ++ \t # \t 8 \t "baz.c" \t
80 ++
81 ++ some syntax error here
82 ++ """)
83 ++ assert str(e.value) == "parse error\nbaz.c:9:14: before: syntax"
84 ++ #
85 ++ e = py.test.raises(CDefError, ffi.cdef, """
86 ++ # 7 "foo//bar.c"
87 ++
88 ++ some syntax error here
89 ++ """)
90 + assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax"
91 +
92 + def test_multiple_line_directives():
93 +@@ -214,6 +229,18 @@ def test_multiple_line_directives():
94 + extern int zz;
95 + """)
96 + assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax"
97 ++ #
98 ++ e = py.test.raises(CDefError, ffi.cdef,
99 ++ """ # 5 "foo.c"
100 ++ extern int xx;
101 ++ # 6 "bar.c"
102 ++ extern int yy;
103 ++ # 7 "baz.c"
104 ++ some syntax error here
105 ++ # 8 "yadda.c"
106 ++ extern int zz;
107 ++ """)
108 ++ assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax"
109 +
110 + def test_commented_line_directive():
111 + ffi = FFI(backend=FakeBackend())
112 +@@ -229,6 +256,20 @@ def test_commented_line_directive():
113 + */
114 + some syntax error
115 + """)
116 ++ #
117 ++ assert str(e.value) == "parse error\nbar.c:9:14: before: syntax"
118 ++ e = py.test.raises(CDefError, ffi.cdef, """
119 ++ /*
120 ++ # 5 "foo.c"
121 ++ */
122 ++ void xx(void);
123 ++
124 ++ # 6 "bar.c"
125 ++ /*
126 ++ # 35 "foo.c"
127 ++ */
128 ++ some syntax error
129 ++ """)
130 + assert str(e.value) == "parse error\nbar.c:9:14: before: syntax"
131 +
132 + def test_line_continuation_in_defines():
133 +--
134 +2.26.2
135 +