1 |
commit: c5757e21c174721dad7cedcf5a7a6642da4e1446 |
2 |
Author: Peter Levine <plevine457 <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Mar 26 02:52:17 2018 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 26 19:14:39 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5757e21 |
7 |
|
8 |
sys-auth/oath-toolkit: Fix building with GCC-7 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/618100 |
11 |
Closes: https://github.com/gentoo/gentoo/pull/7618 |
12 |
Package-Manager: Portage-2.3.16, Repoman-2.3.6 |
13 |
(cherry picked from commit 99a631bb82f619d2553354ca5a0cdf535d4d018b) |
14 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
15 |
|
16 |
.../files/oath-toolkit-2.6.2-gcc7.patch | 80 ++++++++++++++++++++++ |
17 |
sys-auth/oath-toolkit/oath-toolkit-2.6.2.ebuild | 5 +- |
18 |
2 files changed, 84 insertions(+), 1 deletion(-) |
19 |
|
20 |
diff --git a/sys-auth/oath-toolkit/files/oath-toolkit-2.6.2-gcc7.patch b/sys-auth/oath-toolkit/files/oath-toolkit-2.6.2-gcc7.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..18a0a277940 |
23 |
--- /dev/null |
24 |
+++ b/sys-auth/oath-toolkit/files/oath-toolkit-2.6.2-gcc7.patch |
25 |
@@ -0,0 +1,80 @@ |
26 |
+Bug: https://bugs.gentoo.org/618100 |
27 |
+Cherry-picked from upstream commits: https://github.com/coreutils/gnulib/commit/175b4e22f99e00996b72f822f5ae54dca8243d19 |
28 |
+ https://github.com/coreutils/gnulib/commit/abae112b34572cd3869ce4fc81dddb5c2a7394c4 |
29 |
+ |
30 |
+--- a/oathtool/gl/intprops.h |
31 |
++++ b/oathtool/gl/intprops.h |
32 |
+@@ -23,6 +23,10 @@ |
33 |
+ #include <limits.h> |
34 |
+ #include <verify.h> |
35 |
+ |
36 |
++#ifndef __has_builtin |
37 |
++# define __has_builtin(x) 0 |
38 |
++#endif |
39 |
++ |
40 |
+ /* Return a value with the common real type of E and V and the value of V. */ |
41 |
+ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) |
42 |
+ |
43 |
+@@ -222,20 +226,24 @@ |
44 |
+ ? (a) < (min) >> (b) \ |
45 |
+ : (max) >> (b) < (a)) |
46 |
+ |
47 |
+-/* True if __builtin_add_overflow (A, B, P) works when P is null. */ |
48 |
+-#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__) |
49 |
++/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ |
50 |
++#define _GL_HAS_BUILTIN_OVERFLOW \ |
51 |
++ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) |
52 |
++ |
53 |
++#define _GL_HAS_BUILTIN_OVERFLOW_P \ |
54 |
++ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) |
55 |
+ |
56 |
+ /* The _GL*_OVERFLOW macros have the same restrictions as the |
57 |
+ *_RANGE_OVERFLOW macros, except that they do not assume that operands |
58 |
+ (e.g., A and B) have the same type as MIN and MAX. Instead, they assume |
59 |
+ that the result (e.g., A + B) has that type. */ |
60 |
+-#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL |
61 |
+-# define _GL_ADD_OVERFLOW(a, b, min, max) |
62 |
+- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) |
63 |
+-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) |
64 |
+- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) |
65 |
+-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) |
66 |
+- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) |
67 |
++#if _GL_HAS_BUILTIN_OVERFLOW_P |
68 |
++# define _GL_ADD_OVERFLOW(a, b, min, max) \ |
69 |
++ __builtin_add_overflow_p (a, b, (a) + (b)) |
70 |
++# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ |
71 |
++ __builtin_sub_overflow_p (a, b, (a) - (b)) |
72 |
++# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ |
73 |
++ __builtin_mul_overflow_p (a, b, (a) * (b)) |
74 |
+ #else |
75 |
+ # define _GL_ADD_OVERFLOW(a, b, min, max) \ |
76 |
+ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ |
77 |
+@@ -315,7 +323,7 @@ |
78 |
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) |
79 |
+ #define INT_SUBTRACT_OVERFLOW(a, b) \ |
80 |
+ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) |
81 |
+-#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL |
82 |
++#if _GL_HAS_BUILTIN_OVERFLOW || _GL_HAS_BUILTIN_OVERFLOW_P |
83 |
+ # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) |
84 |
+ #else |
85 |
+ # define INT_NEGATE_OVERFLOW(a) \ |
86 |
+@@ -349,10 +357,6 @@ |
87 |
+ #define INT_MULTIPLY_WRAPV(a, b, r) \ |
88 |
+ _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) |
89 |
+ |
90 |
+-#ifndef __has_builtin |
91 |
+-# define __has_builtin(x) 0 |
92 |
+-#endif |
93 |
+- |
94 |
+ /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: |
95 |
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 |
96 |
+ https://llvm.org/bugs/show_bug.cgi?id=25390 |
97 |
+@@ -369,7 +373,7 @@ |
98 |
+ the operation. BUILTIN is the builtin operation, and OVERFLOW the |
99 |
+ overflow predicate. Return 1 if the result overflows. See above |
100 |
+ for restrictions. */ |
101 |
+-#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow) |
102 |
++#if _GL_HAS_BUILTIN_OVERFLOW |
103 |
+ # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) |
104 |
+ #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS |
105 |
+ # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ |
106 |
|
107 |
diff --git a/sys-auth/oath-toolkit/oath-toolkit-2.6.2.ebuild b/sys-auth/oath-toolkit/oath-toolkit-2.6.2.ebuild |
108 |
index 394a6ea3c5f..f3d38999c1e 100644 |
109 |
--- a/sys-auth/oath-toolkit/oath-toolkit-2.6.2.ebuild |
110 |
+++ b/sys-auth/oath-toolkit/oath-toolkit-2.6.2.ebuild |
111 |
@@ -20,7 +20,11 @@ DEPEND="${RDEPEND} |
112 |
test? ( dev-libs/libxml2 ) |
113 |
dev-util/gtk-doc-am" |
114 |
|
115 |
+PATCHES=( "${FILESDIR}"/${P}-gcc7.patch ) |
116 |
+ |
117 |
src_prepare() { |
118 |
+ default |
119 |
+ |
120 |
# These tests need git/cvs and don't reflect anything in the final app |
121 |
sed -i -r \ |
122 |
-e '/TESTS/s,test-vc-list-files-(git|cvs).sh,,g' \ |
123 |
@@ -30,7 +34,6 @@ src_prepare() { |
124 |
-e '/AM_INIT_AUTOMAKE/ s:-Wall:\0 -Wno-portability:' \ |
125 |
{liboath,libpskc}/configure.ac |
126 |
eautoreconf |
127 |
- default |
128 |
} |
129 |
|
130 |
src_configure() { |