Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/squirrelsh/, app-shells/squirrelsh/files/
Date: Fri, 26 May 2017 21:01:12
Message-Id: 1495832331.fc435049e1d73333b656b63a888ade5f008b02dc.soap@gentoo
1 commit: fc435049e1d73333b656b63a888ade5f008b02dc
2 Author: Peter Levine <plevine457 <AT> gmail <DOT> com>
3 AuthorDate: Wed May 24 06:58:09 2017 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Fri May 26 20:58:51 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc435049
7
8 app-shells/squirrelsh: Fix building with GCC-6
9
10 Bug: https://bugs.gentoo.org/show_bug.cgi?id=594466
11 Package-Manager: Portage-2.3.6, Repoman-2.3.2
12 Closes: https://github.com/gentoo/gentoo/pull/4693
13
14 .../squirrelsh/files/squirrelsh-1.2.7-gcc6.patch | 217 +++++++++++++++++++++
15 app-shells/squirrelsh/squirrelsh-1.2.7.ebuild | 3 +-
16 2 files changed, 219 insertions(+), 1 deletion(-)
17
18 diff --git a/app-shells/squirrelsh/files/squirrelsh-1.2.7-gcc6.patch b/app-shells/squirrelsh/files/squirrelsh-1.2.7-gcc6.patch
19 new file mode 100644
20 index 00000000000..ea60d29dc3c
21 --- /dev/null
22 +++ b/app-shells/squirrelsh/files/squirrelsh-1.2.7-gcc6.patch
23 @@ -0,0 +1,217 @@
24 +diff --git a/shell/base.cpp b/shell/base.cpp
25 +index 3a89b6d..33803c3 100644
26 +--- a/shell/base.cpp
27 ++++ b/shell/base.cpp
28 +@@ -1,5 +1,5 @@
29 + // Squirrel Shell
30 +-// Copyright (c) 2006-2010, Constantin Makshin
31 ++// Copyright (c) 2006-2017, Constantin Makshin
32 + //
33 + // This program is free software; you can redistribute it and/or modify
34 + // it under the terms of the GNU General Public License as published by
35 +@@ -15,6 +15,7 @@
36 + // along with this program. If not, see <http://www.gnu.org/licenses/>.
37 +
38 + #include "common.h"
39 ++#include <algorithm>
40 + #include <string.h>
41 + #include <string>
42 +
43 +@@ -36,14 +37,6 @@ typedef HANDLE SysHandle;
44 + typedef int SysHandle;
45 + #endif
46 +
47 +-#if !defined(min)
48 +-# define min(a, b) ((a) < (b) ? (a) : (b))
49 +-#endif
50 +-
51 +-#if !defined(max)
52 +-# define max(a, b) ((a) > (b) ? (a) : (b))
53 +-#endif
54 +-
55 + // Maximum number of command line arguments passed to the child process
56 + #define MAX_ARGS 130
57 + // Maximum number of environment variables passed to the child process
58 +@@ -177,7 +170,7 @@ static bool ReadFromPipe (SysHandle pipe, void* buffer, size_t numBytesToRead, s
59 +
60 + if (!numBytesToRead ||
61 + !PeekNamedPipe(pipe, NULL, 0, NULL, &numBytesAvailable, NULL) || !numBytesAvailable ||
62 +- !ReadFile(pipe, buffer, min(numBytesToRead, numBytesAvailable), &nbr, NULL) || !nbr)
63 ++ !ReadFile(pipe, buffer, std::min(numBytesToRead, numBytesAvailable), &nbr, NULL) || !nbr)
64 + {
65 + return false;
66 + }
67 +@@ -188,7 +181,7 @@ static bool ReadFromPipe (SysHandle pipe, void* buffer, size_t numBytesToRead, s
68 + #else
69 + int nbr = read(pipe, buffer, numBytesToRead);
70 + if (numBytesRead)
71 +- *numBytesRead = max(nbr, 0);
72 ++ *numBytesRead = std::max(nbr, 0);
73 +
74 + return nbr > 0;
75 + #endif
76 +@@ -210,7 +203,7 @@ static bool WriteToPipe (SysHandle pipe, const void* buffer, size_t numBytesToWr
77 + #else
78 + int nbw = write(pipe, buffer, numBytesToWrite);
79 + if (numBytesWritten)
80 +- *numBytesWritten = max(nbw, 0);
81 ++ *numBytesWritten = std::max(nbw, 0);
82 +
83 + return nbw > 0;
84 + #endif
85 +@@ -786,7 +779,7 @@ static SQInteger Run (HSQUIRRELVM)
86 + // Pass data to/from child process' streams
87 + std::basic_string<SQChar> output,
88 + error;
89 +- int nfds = max(newInput[1], max(newOutput[0], newError[0])) + 1;
90 ++ int nfds = std::max(newInput[1], std::max(newOutput[0], newError[0])) + 1;
91 + for (;;)
92 + {
93 + // Check if there's any data available for reading/writing
94 +diff --git a/shell/common.h b/shell/common.h
95 +index 7cb4d47..461410d 100644
96 +--- a/shell/common.h
97 ++++ b/shell/common.h
98 +@@ -1,5 +1,5 @@
99 + // Squirrel Shell
100 +-// Copyright (c) 2006-2010, Constantin Makshin
101 ++// Copyright (c) 2006-2017, Constantin Makshin
102 + //
103 + // This program is free software; you can redistribute it and/or modify
104 + // it under the terms of the GNU General Public License as published by
105 +@@ -47,6 +47,7 @@
106 + # define WIN32_LEAN_AND_MEAN
107 + # define WIN64_LEAN_AND_MEAN
108 + # define STRICT
109 ++# define NOMINMAX
110 + # include <windows.h>
111 + #else
112 + # include <unistd.h>
113 +@@ -88,14 +89,6 @@
114 + # define MAX_PATH 260
115 + #endif
116 +
117 +-#if !defined(min)
118 +-# define min(a, b) ((a) < (b) ? (a) : (b))
119 +-#endif
120 +-
121 +-#if !defined(max)
122 +-# define max(a, b) ((a) > (b) ? (a) : (b))
123 +-#endif
124 +-
125 + #define SQUIRREL_VERSION_SHORT "3.0.3"
126 +
127 + extern HSQUIRRELVM sqvm; // We aren't going to create more than one VM, so it's acceptable to make this global
128 +diff --git a/shell/hash_adler32.cpp b/shell/hash_adler32.cpp
129 +index c42f440..b250875 100644
130 +--- a/shell/hash_adler32.cpp
131 ++++ b/shell/hash_adler32.cpp
132 +@@ -8,6 +8,7 @@
133 + */
134 +
135 + #include "hash.h"
136 ++#include <algorithm>
137 +
138 + #define BASE 65521ul
139 + #define NMAX 5552
140 +@@ -87,7 +88,7 @@ void Hash_Adler32 (FILE* file, unsigned char* block, unsigned char* hash, SQInte
141 + unsigned adler = 1;
142 + do
143 + {
144 +- size_t r = fread(block, 1, min(left, BLOCK_SIZE), file);
145 ++ size_t r = fread(block, 1, size_t(std::min<SQInteger>(left, BLOCK_SIZE)), file);
146 + adler = adler32(adler, block, r);
147 + left -= SQInteger(r);
148 + } while (left);
149 +diff --git a/shell/hash_crc32.cpp b/shell/hash_crc32.cpp
150 +index d18a3aa..9bcb233 100644
151 +--- a/shell/hash_crc32.cpp
152 ++++ b/shell/hash_crc32.cpp
153 +@@ -8,6 +8,7 @@
154 + */
155 +
156 + #include "hash.h"
157 ++#include <algorithm>
158 +
159 + static unsigned crc_table[256];
160 +
161 +@@ -63,7 +64,7 @@ void Hash_CRC32 (FILE* file, unsigned char* block, unsigned char* hash, SQIntege
162 + unsigned crc = 0;
163 + do
164 + {
165 +- size_t r = fread(block, 1, min(left, BLOCK_SIZE), file);
166 ++ size_t r = fread(block, 1, size_t(std::min<SQInteger>(left, BLOCK_SIZE)), file);
167 + crc = crc32(crc, block, r);
168 + left -= SQInteger(r);
169 + } while (left);
170 +diff --git a/shell/hash_md5.cpp b/shell/hash_md5.cpp
171 +index b1a3c2a..a82d4c5 100644
172 +--- a/shell/hash_md5.cpp
173 ++++ b/shell/hash_md5.cpp
174 +@@ -20,6 +20,7 @@
175 + */
176 +
177 + #include "hash.h"
178 ++#include <algorithm>
179 +
180 + struct MD5Context
181 + {
182 +@@ -201,7 +202,7 @@ void Hash_MD5 (FILE* file, unsigned char* block, unsigned char* hash, SQInteger
183 + MD5Init(&ctx);
184 + do
185 + {
186 +- size_t r = fread(block, 1, min(left, BLOCK_SIZE), file);
187 ++ size_t r = fread(block, 1, size_t(std::min<SQInteger>(left, BLOCK_SIZE)), file);
188 + MD5Update(&ctx, block, r);
189 + left -= SQInteger(r);
190 + } while (left);
191 +diff --git a/shell/util.cpp b/shell/util.cpp
192 +index 48983f6..6d0d199 100644
193 +--- a/shell/util.cpp
194 ++++ b/shell/util.cpp
195 +@@ -1,5 +1,5 @@
196 + // Squirrel Shell
197 +-// Copyright (c) 2006-2009, Constantin Makshin
198 ++// Copyright (c) 2006-2017, Constantin Makshin
199 + //
200 + // This program is free software; you can redistribute it and/or modify
201 + // it under the terms of the GNU General Public License as published by
202 +@@ -15,6 +15,7 @@
203 + // along with this program. If not, see <http://www.gnu.org/licenses/>.
204 +
205 + #include "common.h"
206 ++#include <algorithm>
207 + #include <string.h>
208 + #include <ctype.h>
209 +
210 +@@ -123,8 +124,12 @@ SQInteger TimeToInt (unsigned year, unsigned month, unsigned day, unsigned hour,
211 + --day;
212 +
213 + DateAndTime result;
214 +- result.dt.time = (min(hour, 23) * 3600) + (min(minute, 59) * 60) + min(second, 59);
215 +- result.dt.date = (min(year, NUM_YEARS) * 372) + (min(month, 11) * 31) + min(day, NumberOfDays(month, year) - 1);
216 ++ result.dt.time = (std::min<SQInteger>(hour, 23) * 3600)
217 ++ + (std::min<SQInteger>(minute, 59) * 60)
218 ++ + std::min<SQInteger>(second, 59);
219 ++ result.dt.date = (std::min<SQInteger>(year, NUM_YEARS) * 372)
220 ++ + (std::min<SQInteger>(month, 11) * 31)
221 ++ + std::min<SQInteger>(day, NumberOfDays(month, year) - 1);
222 + return result.value;
223 + }
224 +
225 +@@ -798,8 +803,13 @@ static SQInteger MkTime (HSQUIRRELVM)
226 + sq_getinteger(sqvm, 5, &hour);
227 + sq_getinteger(sqvm, 6, &minute);
228 + sq_getinteger(sqvm, 7, &second);
229 +- sq_pushinteger(sqvm, TimeToInt(unsigned(max(year, MIN_YEAR)), unsigned(max(month, 1)), unsigned(max(day, 1)),
230 +- unsigned(max(hour, 0)), unsigned(max(minute, 0)), unsigned(max(second, 0))));
231 ++ sq_pushinteger(sqvm,
232 ++ TimeToInt(unsigned(std::max<SQInteger>(year, MIN_YEAR)),
233 ++ unsigned(std::max<SQInteger>(month, 1)),
234 ++ unsigned(std::max<SQInteger>(day, 1)),
235 ++ unsigned(std::max<SQInteger>(hour, 0)),
236 ++ unsigned(std::max<SQInteger>(minute, 0)),
237 ++ unsigned(std::max<SQInteger>(second, 0))));
238 + return 1;
239 + }
240 +
241
242 diff --git a/app-shells/squirrelsh/squirrelsh-1.2.7.ebuild b/app-shells/squirrelsh/squirrelsh-1.2.7.ebuild
243 index bac408ab83e..9e5aaceff7b 100644
244 --- a/app-shells/squirrelsh/squirrelsh-1.2.7.ebuild
245 +++ b/app-shells/squirrelsh/squirrelsh-1.2.7.ebuild
246 @@ -1,4 +1,4 @@
247 -# Copyright 1999-2016 Gentoo Foundation
248 +# Copyright 1999-2017 Gentoo Foundation
249 # Distributed under the terms of the GNU General Public License v2
250
251 EAPI="4"
252 @@ -24,6 +24,7 @@ src_prepare() {
253 epatch "${FILESDIR}"/${PN}-fix-in_LDFLAGS.patch
254 epatch "${FILESDIR}"/${PN}-remove-forced-abi.patch
255 epatch "${FILESDIR}"/${PN}-no-docs.patch
256 + epatch "${FILESDIR}"/${P}-gcc6.patch
257 }
258
259 src_configure() {