Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-editors/neovim/, app-editors/neovim/files/
Date: Tue, 29 Sep 2020 10:26:58
Message-Id: 1601375160.6adf2a312c7176e82e8436c55c42d47963a0813e.juippis@gentoo
1 commit: 6adf2a312c7176e82e8436c55c42d47963a0813e
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 29 10:18:04 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 29 10:26:00 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6adf2a31
7
8 app-editors/neovim: gcc-10 fix for 0.4.3
9
10 - non-maintainer commit, but thoroughly tested.
11
12 Closes: https://bugs.gentoo.org/714130
13 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
14
15 .../neovim/files/neovim-0.4.3-gcc-10-fix.patch | 225 +++++++++++++++++++++
16 app-editors/neovim/neovim-0.4.3.ebuild | 2 +
17 2 files changed, 227 insertions(+)
18
19 diff --git a/app-editors/neovim/files/neovim-0.4.3-gcc-10-fix.patch b/app-editors/neovim/files/neovim-0.4.3-gcc-10-fix.patch
20 new file mode 100644
21 index 00000000000..5826d62ce6c
22 --- /dev/null
23 +++ b/app-editors/neovim/files/neovim-0.4.3-gcc-10-fix.patch
24 @@ -0,0 +1,225 @@
25 +From ebcde1de42588e697e0f4eaed9f6f0ea6a77a2cd Mon Sep 17 00:00:00 2001
26 +From: Andreas Schneider <asn@××××××××××.org>
27 +Date: Mon, 17 Feb 2020 16:33:55 +0100
28 +Subject: [PATCH 1/6] nvim:eval: Fix enum declaration for ListLenSpecials
29 +
30 +Instead of declaring an enum, this creates a global variable. As gcc10
31 +uses -fno-common by default, global variables declared with the same
32 +name more than once is not allowed anymore revealing this issue.
33 +
34 +Each time this header is included, we define the enum name as a global
35 +variable.
36 +
37 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
38 +---
39 + src/nvim/eval/typval.h | 4 ++--
40 + 1 file changed, 2 insertions(+), 2 deletions(-)
41 +
42 +diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h
43 +index 008453b87f2f..5afdedff751b 100644
44 +--- a/src/nvim/eval/typval.h
45 ++++ b/src/nvim/eval/typval.h
46 +@@ -33,7 +33,7 @@ typedef double float_T;
47 + enum { DO_NOT_FREE_CNT = (INT_MAX / 2) };
48 +
49 + /// Additional values for tv_list_alloc() len argument
50 +-enum {
51 ++enum ListLenSpecials {
52 + /// List length is not known in advance
53 + ///
54 + /// To be used when there is neither a way to know how many elements will be
55 +@@ -49,7 +49,7 @@ enum {
56 + ///
57 + /// To be used when it looks impractical to determine list length.
58 + kListLenMayKnow = -3,
59 +-} ListLenSpecials;
60 ++};
61 +
62 + /// Maximal possible value of varnumber_T variable
63 + #define VARNUMBER_MAX INT64_MAX
64 +
65 +From b87b4a61476bb65e9200bd2ee93b8a98ca4db84e Mon Sep 17 00:00:00 2001
66 +From: Andreas Schneider <asn@××××××××××.org>
67 +Date: Mon, 17 Feb 2020 17:17:37 +0100
68 +Subject: [PATCH 2/6] nvim:viml: Fix enum declaration of ExprParserFlags
69 +
70 +Instead of declaring an enum, this creates a global variable. As gcc10
71 +uses -fno-common by default, global variables declared with the same
72 +name more than once is not allowed anymore revealing this issue.
73 +
74 +Each time this header is included, we define the enum name as a global
75 +variable.
76 +
77 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
78 +---
79 + src/nvim/viml/parser/expressions.h | 4 ++--
80 + 1 file changed, 2 insertions(+), 2 deletions(-)
81 +
82 +diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h
83 +index 23e172da75b2..838a74227182 100644
84 +--- a/src/nvim/viml/parser/expressions.h
85 ++++ b/src/nvim/viml/parser/expressions.h
86 +@@ -326,7 +326,7 @@ struct expr_ast_node {
87 + } data;
88 + };
89 +
90 +-enum {
91 ++enum ExprParserFlags {
92 + /// Allow multiple expressions in a row: e.g. for :echo
93 + ///
94 + /// Parser will still parse only one of them though.
95 +@@ -345,7 +345,7 @@ enum {
96 + // viml_expressions_parser.c, nvim_parse_expression() flags parsing
97 + // alongside with its documentation and flag sets in check_parsing()
98 + // function in expressions parser functional and unit tests.
99 +-} ExprParserFlags;
100 ++};
101 +
102 + /// AST error definition
103 + typedef struct {
104 +
105 +From 986db1adb491b5cb5936d2369816236847af26da Mon Sep 17 00:00:00 2001
106 +From: Andreas Schneider <asn@××××××××××.org>
107 +Date: Mon, 17 Feb 2020 16:36:21 +0100
108 +Subject: [PATCH 3/6] nvim: Fix enum declaration of RemapValues
109 +
110 +Instead of declaring an enum, this creates a global variable. As gcc10
111 +uses -fno-common by default, global variables declared with the same
112 +name more than once is not allowed anymore revealing this issue.
113 +
114 +Each time this header is included, we define the enum name as a global
115 +variable.
116 +
117 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
118 +---
119 + src/nvim/getchar.h | 4 ++--
120 + 1 file changed, 2 insertions(+), 2 deletions(-)
121 +
122 +diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h
123 +index 01f60ccf4945..f0b52079aad1 100644
124 +--- a/src/nvim/getchar.h
125 ++++ b/src/nvim/getchar.h
126 +@@ -10,12 +10,12 @@
127 + /// Values for "noremap" argument of ins_typebuf()
128 + ///
129 + /// Also used for map->m_noremap and menu->noremap[].
130 +-enum {
131 ++enum RemapValues {
132 + REMAP_YES = 0, ///< Allow remapping.
133 + REMAP_NONE = -1, ///< No remapping.
134 + REMAP_SCRIPT = -2, ///< Remap script-local mappings only.
135 + REMAP_SKIP = -3, ///< No remapping for first char.
136 +-} RemapValues;
137 ++};
138 +
139 + // Argument for flush_buffers().
140 + typedef enum {
141 +
142 +From 517bf15603aba37014b62553eb008e26f2a1db48 Mon Sep 17 00:00:00 2001
143 +From: Andreas Schneider <asn@××××××××××.org>
144 +Date: Mon, 17 Feb 2020 16:40:37 +0100
145 +Subject: [PATCH 4/6] nvim:msgpack: Correctly set up global
146 + ch_before_blocking_events
147 +
148 +gcc10 builds with -fno-common by default. This mean you can't define
149 +a global variable with the same name twice.
150 +
151 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
152 +---
153 + src/nvim/msgpack_rpc/channel.h | 2 +-
154 + 1 file changed, 1 insertion(+), 1 deletion(-)
155 +
156 +diff --git a/src/nvim/msgpack_rpc/channel.h b/src/nvim/msgpack_rpc/channel.h
157 +index 9ff5abdc5f55..90e1c7d48b4c 100644
158 +--- a/src/nvim/msgpack_rpc/channel.h
159 ++++ b/src/nvim/msgpack_rpc/channel.h
160 +@@ -15,7 +15,7 @@
161 + /// HACK: os/input.c drains this queue immediately before blocking for input.
162 + /// Events on this queue are async-safe, but they need the resolved state
163 + /// of os_inchar(), so they are processed "just-in-time".
164 +-MultiQueue *ch_before_blocking_events;
165 ++EXTERN MultiQueue *ch_before_blocking_events INIT(= NULL);
166 +
167 +
168 + #ifdef INCLUDE_GENERATED_DECLARATIONS
169 +
170 +From 823b2104c3e579e8c3db8baab263dca0aa9d48bc Mon Sep 17 00:00:00 2001
171 +From: Andreas Schneider <asn@××××××××××.org>
172 +Date: Mon, 17 Feb 2020 17:29:12 +0100
173 +Subject: [PATCH 5/6] nvim: Correctly setup global channels
174 +
175 +As gcc10 uses -fno-common by default, global variables declared with the
176 +same name more than once is not allowed anymore revealing this issue.
177 +
178 +We need to define it as extern to access it.
179 +
180 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
181 +---
182 + src/nvim/channel.c | 1 -
183 + src/nvim/channel.h | 2 +-
184 + src/nvim/main.c | 1 +
185 + 3 files changed, 2 insertions(+), 2 deletions(-)
186 +
187 +diff --git a/src/nvim/channel.c b/src/nvim/channel.c
188 +index c66a0682e351..5eb29a7290c2 100644
189 +--- a/src/nvim/channel.c
190 ++++ b/src/nvim/channel.c
191 +@@ -19,7 +19,6 @@
192 + #include "nvim/ascii.h"
193 +
194 + static bool did_stdio = false;
195 +-PMap(uint64_t) *channels = NULL;
196 +
197 + /// next free id for a job or rpc channel
198 + /// 1 is reserved for stdio channel
199 +diff --git a/src/nvim/channel.h b/src/nvim/channel.h
200 +index c733e276bef2..9d26852ce532 100644
201 +--- a/src/nvim/channel.h
202 ++++ b/src/nvim/channel.h
203 +@@ -85,7 +85,7 @@ struct Channel {
204 + bool callback_scheduled;
205 + };
206 +
207 +-EXTERN PMap(uint64_t) *channels;
208 ++EXTERN PMap(uint64_t) *channels INIT(= NULL);
209 +
210 + #ifdef INCLUDE_GENERATED_DECLARATIONS
211 + # include "channel.h.generated.h"
212 +diff --git a/src/nvim/main.c b/src/nvim/main.c
213 +index 56d9030a7f42..4a9f2371a298 100644
214 +--- a/src/nvim/main.c
215 ++++ b/src/nvim/main.c
216 +@@ -10,6 +10,7 @@
217 + #include <msgpack.h>
218 +
219 + #include "nvim/ascii.h"
220 ++#include "nvim/channel.h"
221 + #include "nvim/vim.h"
222 + #include "nvim/main.h"
223 + #include "nvim/aucmd.h"
224 +
225 +From 0504f2f88dac9a4cf1fe1052a1e00ab203e9cf8e Mon Sep 17 00:00:00 2001
226 +From: Andreas Schneider <asn@××××××××××.org>
227 +Date: Mon, 17 Feb 2020 18:04:01 +0100
228 +Subject: [PATCH 6/6] cmake: Check for -fno-common and use it if available
229 +
230 +---
231 + CMakeLists.txt | 5 +++++
232 + 1 file changed, 5 insertions(+)
233 +
234 +diff --git a/CMakeLists.txt b/CMakeLists.txt
235 +index de530bb4f7da..74e161d98907 100644
236 +--- a/CMakeLists.txt
237 ++++ b/CMakeLists.txt
238 +@@ -308,6 +308,11 @@ if(UNIX)
239 + endif()
240 + endif()
241 +
242 ++check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
243 ++if (HAVE_FNO_COMMON)
244 ++ add_compile_options(-fno-common)
245 ++endif()
246 ++
247 + check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
248 + if(HAS_DIAG_COLOR_FLAG)
249 + if(CMAKE_GENERATOR MATCHES "Ninja")
250
251 diff --git a/app-editors/neovim/neovim-0.4.3.ebuild b/app-editors/neovim/neovim-0.4.3.ebuild
252 index 34583324d16..3c3a8cc28cb 100644
253 --- a/app-editors/neovim/neovim-0.4.3.ebuild
254 +++ b/app-editors/neovim/neovim-0.4.3.ebuild
255 @@ -53,6 +53,8 @@ RDEPEND="
256
257 CMAKE_BUILD_TYPE=Release
258
259 +PATCHES=( "${FILESDIR}"/${P}-gcc-10-fix.patch )
260 +
261 src_prepare() {
262 # use our system vim dir
263 sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \