zerotier: fix compilation with GCC10 12843/head
authorRosen Penev <rosenp@gmail.com>
Thu, 16 Jul 2020 21:11:17 +0000 (14:11 -0700)
committerRosen Penev <rosenp@gmail.com>
Thu, 16 Jul 2020 21:31:54 +0000 (14:31 -0700)
Patch taken from upstream.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
net/zerotier/Makefile
net/zerotier/patches/030-gcc10.patch [new file with mode: 0644]

index 4baee00d3193ceb1cc3616d2e8ecf908998cbff7..72712473a45697b48249e50e7e3d7b93eb84df63 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zerotier
 PKG_VERSION:=1.4.6
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/$(PKG_VERSION)?
diff --git a/net/zerotier/patches/030-gcc10.patch b/net/zerotier/patches/030-gcc10.patch
new file mode 100644 (file)
index 0000000..f55270d
--- /dev/null
@@ -0,0 +1,39 @@
+From cce4fa719d447c55d93458b25fa92717a2d61a60 Mon Sep 17 00:00:00 2001
+From: Jonas Witschel <diabonas@archlinux.org>
+Date: Tue, 14 Jul 2020 14:20:16 +0200
+Subject: [PATCH] Fix compilation with GCC 10 by providing explicit cast of
+ _bindingCount
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Compilation with GCC 10 fails with the following error:
+
+service/../osdep/Binder.hpp: In member function ‘void ZeroTier::Binder::refresh(ZeroTier::Phy<PHY_HANDLER_TYPE>&, unsigned int*, unsigned int, std::vector<ZeroTier::InetAddress>, INTERFACE_CHECKER&)’:
+service/../osdep/Binder.hpp:376:30: internal compiler error: unexpected expression ‘(std::__atomic_base<unsigned int>::__int_type)((ZeroTier::Binder*)this)->ZeroTier::Binder::_bindingCount’ of kind implicit_conv_expr
+  376 |       _bindings[_bindingCount].udpSock = udps;
+      |                              ^
+
+Help the compiler by providing an explicit cast to the appropriate type like it
+is already done in l. 338 of the same file.
+---
+ osdep/Binder.hpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp
+index 660e6f0c..a5bc85c9 100644
+--- a/osdep/Binder.hpp
++++ b/osdep/Binder.hpp
+@@ -373,9 +373,9 @@ class Binder
+                                       }
+ #endif // __LINUX__
+                                       if (_bindingCount < ZT_BINDER_MAX_BINDINGS) {
+-                                              _bindings[_bindingCount].udpSock = udps;
+-                                              _bindings[_bindingCount].tcpListenSock = tcps;
+-                                              _bindings[_bindingCount].address = ii->first;
++                                              _bindings[(unsigned int)_bindingCount].udpSock = udps;
++                                              _bindings[(unsigned int)_bindingCount].tcpListenSock = tcps;
++                                              _bindings[(unsigned int)_bindingCount].address = ii->first;
+                                               phy.setIfName(udps,(char*)ii->second.c_str(),(int)ii->second.length());
+                                               ++_bindingCount;
+                                       }