summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonas Niilola <juippis@gentoo.org>2020-09-29 13:18:04 +0300
committerJoonas Niilola <juippis@gentoo.org>2020-09-29 13:26:00 +0300
commit6adf2a312c7176e82e8436c55c42d47963a0813e (patch)
treed378920f97d9ee7e39a73f15e997074cbee8447a /app-editors
parentnet-dns/dnssec-tools: add missing inherit, restrict tests (diff)
downloadgentoo-6adf2a312c7176e82e8436c55c42d47963a0813e.tar.gz
gentoo-6adf2a312c7176e82e8436c55c42d47963a0813e.tar.bz2
gentoo-6adf2a312c7176e82e8436c55c42d47963a0813e.zip
app-editors/neovim: gcc-10 fix for 0.4.3
- non-maintainer commit, but thoroughly tested. Closes: https://bugs.gentoo.org/714130 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-editors')
-rw-r--r--app-editors/neovim/files/neovim-0.4.3-gcc-10-fix.patch225
-rw-r--r--app-editors/neovim/neovim-0.4.3.ebuild2
2 files changed, 227 insertions, 0 deletions
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
new file mode 100644
index 000000000000..5826d62ce6c1
--- /dev/null
+++ b/app-editors/neovim/files/neovim-0.4.3-gcc-10-fix.patch
@@ -0,0 +1,225 @@
+From ebcde1de42588e697e0f4eaed9f6f0ea6a77a2cd Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 16:33:55 +0100
+Subject: [PATCH 1/6] nvim:eval: Fix enum declaration for ListLenSpecials
+
+Instead of declaring an enum, this creates a global variable. As gcc10
+uses -fno-common by default, global variables declared with the same
+name more than once is not allowed anymore revealing this issue.
+
+Each time this header is included, we define the enum name as a global
+variable.
+
+See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
+---
+ src/nvim/eval/typval.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h
+index 008453b87f2f..5afdedff751b 100644
+--- a/src/nvim/eval/typval.h
++++ b/src/nvim/eval/typval.h
+@@ -33,7 +33,7 @@ typedef double float_T;
+ enum { DO_NOT_FREE_CNT = (INT_MAX / 2) };
+
+ /// Additional values for tv_list_alloc() len argument
+-enum {
++enum ListLenSpecials {
+ /// List length is not known in advance
+ ///
+ /// To be used when there is neither a way to know how many elements will be
+@@ -49,7 +49,7 @@ enum {
+ ///
+ /// To be used when it looks impractical to determine list length.
+ kListLenMayKnow = -3,
+-} ListLenSpecials;
++};
+
+ /// Maximal possible value of varnumber_T variable
+ #define VARNUMBER_MAX INT64_MAX
+
+From b87b4a61476bb65e9200bd2ee93b8a98ca4db84e Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 17:17:37 +0100
+Subject: [PATCH 2/6] nvim:viml: Fix enum declaration of ExprParserFlags
+
+Instead of declaring an enum, this creates a global variable. As gcc10
+uses -fno-common by default, global variables declared with the same
+name more than once is not allowed anymore revealing this issue.
+
+Each time this header is included, we define the enum name as a global
+variable.
+
+See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
+---
+ src/nvim/viml/parser/expressions.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h
+index 23e172da75b2..838a74227182 100644
+--- a/src/nvim/viml/parser/expressions.h
++++ b/src/nvim/viml/parser/expressions.h
+@@ -326,7 +326,7 @@ struct expr_ast_node {
+ } data;
+ };
+
+-enum {
++enum ExprParserFlags {
+ /// Allow multiple expressions in a row: e.g. for :echo
+ ///
+ /// Parser will still parse only one of them though.
+@@ -345,7 +345,7 @@ enum {
+ // viml_expressions_parser.c, nvim_parse_expression() flags parsing
+ // alongside with its documentation and flag sets in check_parsing()
+ // function in expressions parser functional and unit tests.
+-} ExprParserFlags;
++};
+
+ /// AST error definition
+ typedef struct {
+
+From 986db1adb491b5cb5936d2369816236847af26da Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 16:36:21 +0100
+Subject: [PATCH 3/6] nvim: Fix enum declaration of RemapValues
+
+Instead of declaring an enum, this creates a global variable. As gcc10
+uses -fno-common by default, global variables declared with the same
+name more than once is not allowed anymore revealing this issue.
+
+Each time this header is included, we define the enum name as a global
+variable.
+
+See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
+---
+ src/nvim/getchar.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h
+index 01f60ccf4945..f0b52079aad1 100644
+--- a/src/nvim/getchar.h
++++ b/src/nvim/getchar.h
+@@ -10,12 +10,12 @@
+ /// Values for "noremap" argument of ins_typebuf()
+ ///
+ /// Also used for map->m_noremap and menu->noremap[].
+-enum {
++enum RemapValues {
+ REMAP_YES = 0, ///< Allow remapping.
+ REMAP_NONE = -1, ///< No remapping.
+ REMAP_SCRIPT = -2, ///< Remap script-local mappings only.
+ REMAP_SKIP = -3, ///< No remapping for first char.
+-} RemapValues;
++};
+
+ // Argument for flush_buffers().
+ typedef enum {
+
+From 517bf15603aba37014b62553eb008e26f2a1db48 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 16:40:37 +0100
+Subject: [PATCH 4/6] nvim:msgpack: Correctly set up global
+ ch_before_blocking_events
+
+gcc10 builds with -fno-common by default. This mean you can't define
+a global variable with the same name twice.
+
+See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
+---
+ src/nvim/msgpack_rpc/channel.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/nvim/msgpack_rpc/channel.h b/src/nvim/msgpack_rpc/channel.h
+index 9ff5abdc5f55..90e1c7d48b4c 100644
+--- a/src/nvim/msgpack_rpc/channel.h
++++ b/src/nvim/msgpack_rpc/channel.h
+@@ -15,7 +15,7 @@
+ /// HACK: os/input.c drains this queue immediately before blocking for input.
+ /// Events on this queue are async-safe, but they need the resolved state
+ /// of os_inchar(), so they are processed "just-in-time".
+-MultiQueue *ch_before_blocking_events;
++EXTERN MultiQueue *ch_before_blocking_events INIT(= NULL);
+
+
+ #ifdef INCLUDE_GENERATED_DECLARATIONS
+
+From 823b2104c3e579e8c3db8baab263dca0aa9d48bc Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 17:29:12 +0100
+Subject: [PATCH 5/6] nvim: Correctly setup global channels
+
+As gcc10 uses -fno-common by default, global variables declared with the
+same name more than once is not allowed anymore revealing this issue.
+
+We need to define it as extern to access it.
+
+See also https://bugzilla.redhat.com/show_bug.cgi?id=1799680
+---
+ src/nvim/channel.c | 1 -
+ src/nvim/channel.h | 2 +-
+ src/nvim/main.c | 1 +
+ 3 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/nvim/channel.c b/src/nvim/channel.c
+index c66a0682e351..5eb29a7290c2 100644
+--- a/src/nvim/channel.c
++++ b/src/nvim/channel.c
+@@ -19,7 +19,6 @@
+ #include "nvim/ascii.h"
+
+ static bool did_stdio = false;
+-PMap(uint64_t) *channels = NULL;
+
+ /// next free id for a job or rpc channel
+ /// 1 is reserved for stdio channel
+diff --git a/src/nvim/channel.h b/src/nvim/channel.h
+index c733e276bef2..9d26852ce532 100644
+--- a/src/nvim/channel.h
++++ b/src/nvim/channel.h
+@@ -85,7 +85,7 @@ struct Channel {
+ bool callback_scheduled;
+ };
+
+-EXTERN PMap(uint64_t) *channels;
++EXTERN PMap(uint64_t) *channels INIT(= NULL);
+
+ #ifdef INCLUDE_GENERATED_DECLARATIONS
+ # include "channel.h.generated.h"
+diff --git a/src/nvim/main.c b/src/nvim/main.c
+index 56d9030a7f42..4a9f2371a298 100644
+--- a/src/nvim/main.c
++++ b/src/nvim/main.c
+@@ -10,6 +10,7 @@
+ #include <msgpack.h>
+
+ #include "nvim/ascii.h"
++#include "nvim/channel.h"
+ #include "nvim/vim.h"
+ #include "nvim/main.h"
+ #include "nvim/aucmd.h"
+
+From 0504f2f88dac9a4cf1fe1052a1e00ab203e9cf8e Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Mon, 17 Feb 2020 18:04:01 +0100
+Subject: [PATCH 6/6] cmake: Check for -fno-common and use it if available
+
+---
+ CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index de530bb4f7da..74e161d98907 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -308,6 +308,11 @@ if(UNIX)
+ endif()
+ endif()
+
++check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
++if (HAVE_FNO_COMMON)
++ add_compile_options(-fno-common)
++endif()
++
+ check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
+ if(HAS_DIAG_COLOR_FLAG)
+ if(CMAKE_GENERATOR MATCHES "Ninja")
diff --git a/app-editors/neovim/neovim-0.4.3.ebuild b/app-editors/neovim/neovim-0.4.3.ebuild
index 34583324d168..3c3a8cc28cb8 100644
--- a/app-editors/neovim/neovim-0.4.3.ebuild
+++ b/app-editors/neovim/neovim-0.4.3.ebuild
@@ -53,6 +53,8 @@ RDEPEND="
CMAKE_BUILD_TYPE=Release
+PATCHES=( "${FILESDIR}"/${P}-gcc-10-fix.patch )
+
src_prepare() {
# use our system vim dir
sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \