1 |
commit: 9705417206ffb856164627f9b3ee7f49931ff8f7 |
2 |
Author: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 2 03:11:27 2022 +0000 |
4 |
Commit: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 2 03:26:00 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97054172 |
7 |
|
8 |
sys-libs/timezone-data: fix C23 conformance / gcc-13 build for 2022g |
9 |
|
10 |
Closes: https://bugs.gentoo.org/883719 |
11 |
Reviewed-by: Sam James <sam <AT> gentoo.org> |
12 |
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org> |
13 |
|
14 |
.../files/timezone-data-2022g-c23.patch | 279 +++++++++++++++++++++ |
15 |
sys-libs/timezone-data/timezone-data-2022g.ebuild | 4 + |
16 |
2 files changed, 283 insertions(+) |
17 |
|
18 |
diff --git a/sys-libs/timezone-data/files/timezone-data-2022g-c23.patch b/sys-libs/timezone-data/files/timezone-data-2022g-c23.patch |
19 |
new file mode 100644 |
20 |
index 000000000000..2665841e5aa5 |
21 |
--- /dev/null |
22 |
+++ b/sys-libs/timezone-data/files/timezone-data-2022g-c23.patch |
23 |
@@ -0,0 +1,279 @@ |
24 |
+https://github.com/eggert/tz/commit/9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f |
25 |
+but minus the NEWS changes |
26 |
+ |
27 |
+From: Paul Eggert <eggert@×××××××.edu> |
28 |
+Date: Thu, 1 Dec 2022 10:28:04 -0800 |
29 |
+Subject: [PATCH] Fix C23-related conformance bug |
30 |
+MIME-Version: 1.0 |
31 |
+Content-Type: text/plain; charset=UTF-8 |
32 |
+Content-Transfer-Encoding: 8bit |
33 |
+ |
34 |
+Problem reported by Houge Langley for ‘gcc -std=gnu99’ in: |
35 |
+https://bugs.gentoo.org/show_bug.cgi?id=883719 |
36 |
+* NEWS: Mention this. |
37 |
+* date.c, localtime.c, private.h, zdump.c, zic.c: |
38 |
+Use ATTRIBUTE_* at the start of function declarations, |
39 |
+not later (such as after the keyword ‘static’). |
40 |
+This is required for strict conformance to C23. |
41 |
+--- a/date.c |
42 |
++++ b/date.c |
43 |
+@@ -42,7 +42,7 @@ static void display(const char *, time_t); |
44 |
+ static void dogmt(void); |
45 |
+ static void errensure(void); |
46 |
+ static void timeout(FILE *, const char *, const struct tm *); |
47 |
+-static ATTRIBUTE_NORETURN void usage(void); |
48 |
++ATTRIBUTE_NORETURN static void usage(void); |
49 |
+ |
50 |
+ int |
51 |
+ main(const int argc, char *argv[]) |
52 |
+--- a/localtime.c |
53 |
++++ b/localtime.c |
54 |
+@@ -843,7 +843,7 @@ is_digit(char c) |
55 |
+ ** Return a pointer to that character. |
56 |
+ */ |
57 |
+ |
58 |
+-static ATTRIBUTE_REPRODUCIBLE const char * |
59 |
++ATTRIBUTE_REPRODUCIBLE static const char * |
60 |
+ getzname(register const char *strp) |
61 |
+ { |
62 |
+ register char c; |
63 |
+@@ -864,7 +864,7 @@ getzname(register const char *strp) |
64 |
+ ** We don't do any checking here; checking is done later in common-case code. |
65 |
+ */ |
66 |
+ |
67 |
+-static ATTRIBUTE_REPRODUCIBLE const char * |
68 |
++ATTRIBUTE_REPRODUCIBLE static const char * |
69 |
+ getqzname(register const char *strp, const int delim) |
70 |
+ { |
71 |
+ register int c; |
72 |
+--- a/private.h |
73 |
++++ b/private.h |
74 |
+@@ -646,7 +646,7 @@ DEPRECATED_IN_C23 char *asctime(struct tm const *); |
75 |
+ char *asctime_r(struct tm const *restrict, char *restrict); |
76 |
+ DEPRECATED_IN_C23 char *ctime(time_t const *); |
77 |
+ char *ctime_r(time_t const *, char *); |
78 |
+-double difftime(time_t, time_t) ATTRIBUTE_UNSEQUENCED; |
79 |
++ATTRIBUTE_UNSEQUENCED double difftime(time_t, time_t); |
80 |
+ size_t strftime(char *restrict, size_t, char const *restrict, |
81 |
+ struct tm const *restrict); |
82 |
+ # if HAVE_STRFTIME_L |
83 |
+@@ -765,10 +765,10 @@ timezone_t tzalloc(char const *); |
84 |
+ void tzfree(timezone_t); |
85 |
+ # if STD_INSPIRED |
86 |
+ # if TZ_TIME_T || !defined posix2time_z |
87 |
+-time_t posix2time_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; |
88 |
++ATTRIBUTE_REPRODUCIBLE time_t posix2time_z(timezone_t, time_t); |
89 |
+ # endif |
90 |
+ # if TZ_TIME_T || !defined time2posix_z |
91 |
+-time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; |
92 |
++ATTRIBUTE_REPRODUCIBLE time_t time2posix_z(timezone_t, time_t); |
93 |
+ # endif |
94 |
+ # endif |
95 |
+ #endif |
96 |
+--- a/zdump.c |
97 |
++++ b/zdump.c |
98 |
+@@ -89,7 +89,7 @@ static bool warned; |
99 |
+ static bool errout; |
100 |
+ |
101 |
+ static char const *abbr(struct tm const *); |
102 |
+-static intmax_t delta(struct tm *, struct tm *) ATTRIBUTE_REPRODUCIBLE; |
103 |
++ATTRIBUTE_REPRODUCIBLE static intmax_t delta(struct tm *, struct tm *); |
104 |
+ static void dumptime(struct tm const *); |
105 |
+ static time_t hunt(timezone_t, time_t, time_t, bool); |
106 |
+ static void show(timezone_t, char *, time_t, bool); |
107 |
+@@ -97,7 +97,7 @@ static void showextrema(timezone_t, char *, time_t, struct tm *, time_t); |
108 |
+ static void showtrans(char const *, struct tm const *, time_t, char const *, |
109 |
+ char const *); |
110 |
+ static const char *tformat(void); |
111 |
+-static time_t yeartot(intmax_t) ATTRIBUTE_REPRODUCIBLE; |
112 |
++ATTRIBUTE_REPRODUCIBLE static time_t yeartot(intmax_t); |
113 |
+ |
114 |
+ /* Is C an ASCII digit? */ |
115 |
+ static bool |
116 |
+@@ -125,7 +125,7 @@ is_alpha(char a) |
117 |
+ } |
118 |
+ } |
119 |
+ |
120 |
+-static ATTRIBUTE_NORETURN void |
121 |
++ATTRIBUTE_NORETURN static void |
122 |
+ size_overflow(void) |
123 |
+ { |
124 |
+ fprintf(stderr, _("%s: size overflow\n"), progname); |
125 |
+@@ -134,7 +134,7 @@ size_overflow(void) |
126 |
+ |
127 |
+ /* Return A + B, exiting if the result would overflow either ptrdiff_t |
128 |
+ or size_t. */ |
129 |
+-static ATTRIBUTE_REPRODUCIBLE ptrdiff_t |
130 |
++ATTRIBUTE_REPRODUCIBLE static ptrdiff_t |
131 |
+ sumsize(size_t a, size_t b) |
132 |
+ { |
133 |
+ #ifdef ckd_add |
134 |
+@@ -151,7 +151,7 @@ sumsize(size_t a, size_t b) |
135 |
+ |
136 |
+ /* Return a pointer to a newly allocated buffer of size SIZE, exiting |
137 |
+ on failure. SIZE should be nonzero. */ |
138 |
+-static void * ATTRIBUTE_MALLOC |
139 |
++ATTRIBUTE_MALLOC static void * |
140 |
+ xmalloc(size_t size) |
141 |
+ { |
142 |
+ void *p = malloc(size); |
143 |
+@@ -916,7 +916,7 @@ showextrema(timezone_t tz, char *zone, time_t lo, struct tm *lotmp, time_t hi) |
144 |
+ # include <stdarg.h> |
145 |
+ |
146 |
+ /* A substitute for snprintf that is good enough for zdump. */ |
147 |
+-static int ATTRIBUTE_FORMAT((printf, 3, 4)) |
148 |
++ATTRIBUTE_FORMAT((printf, 3, 4)) static int |
149 |
+ my_snprintf(char *s, size_t size, char const *format, ...) |
150 |
+ { |
151 |
+ int n; |
152 |
+--- a/zic.c |
153 |
++++ b/zic.c |
154 |
+@@ -459,20 +459,20 @@ static char roll[TZ_MAX_LEAPS]; |
155 |
+ ** Memory allocation. |
156 |
+ */ |
157 |
+ |
158 |
+-static ATTRIBUTE_NORETURN void |
159 |
++ATTRIBUTE_NORETURN static void |
160 |
+ memory_exhausted(const char *msg) |
161 |
+ { |
162 |
+ fprintf(stderr, _("%s: Memory exhausted: %s\n"), progname, msg); |
163 |
+ exit(EXIT_FAILURE); |
164 |
+ } |
165 |
+ |
166 |
+-static ATTRIBUTE_NORETURN void |
167 |
++ATTRIBUTE_NORETURN static void |
168 |
+ size_overflow(void) |
169 |
+ { |
170 |
+ memory_exhausted(_("size overflow")); |
171 |
+ } |
172 |
+ |
173 |
+-static ATTRIBUTE_REPRODUCIBLE ptrdiff_t |
174 |
++ATTRIBUTE_REPRODUCIBLE static ptrdiff_t |
175 |
+ size_sum(size_t a, size_t b) |
176 |
+ { |
177 |
+ #ifdef ckd_add |
178 |
+@@ -487,7 +487,7 @@ size_sum(size_t a, size_t b) |
179 |
+ size_overflow(); |
180 |
+ } |
181 |
+ |
182 |
+-static ATTRIBUTE_REPRODUCIBLE ptrdiff_t |
183 |
++ATTRIBUTE_REPRODUCIBLE static ptrdiff_t |
184 |
+ size_product(ptrdiff_t nitems, ptrdiff_t itemsize) |
185 |
+ { |
186 |
+ #ifdef ckd_mul |
187 |
+@@ -502,7 +502,7 @@ size_product(ptrdiff_t nitems, ptrdiff_t itemsize) |
188 |
+ size_overflow(); |
189 |
+ } |
190 |
+ |
191 |
+-static ATTRIBUTE_REPRODUCIBLE ptrdiff_t |
192 |
++ATTRIBUTE_REPRODUCIBLE static ptrdiff_t |
193 |
+ align_to(ptrdiff_t size, ptrdiff_t alignment) |
194 |
+ { |
195 |
+ ptrdiff_t lo_bits = alignment - 1, sum = size_sum(size, lo_bits); |
196 |
+@@ -526,7 +526,7 @@ memcheck(void *ptr) |
197 |
+ return ptr; |
198 |
+ } |
199 |
+ |
200 |
+-static void * ATTRIBUTE_MALLOC |
201 |
++ATTRIBUTE_MALLOC static void * |
202 |
+ emalloc(size_t size) |
203 |
+ { |
204 |
+ return memcheck(malloc(size)); |
205 |
+@@ -538,7 +538,7 @@ erealloc(void *ptr, size_t size) |
206 |
+ return memcheck(realloc(ptr, size)); |
207 |
+ } |
208 |
+ |
209 |
+-static char * ATTRIBUTE_MALLOC |
210 |
++ATTRIBUTE_MALLOC static char * |
211 |
+ estrdup(char const *str) |
212 |
+ { |
213 |
+ return memcheck(strdup(str)); |
214 |
+@@ -608,7 +608,7 @@ eat(int fnum, lineno num) |
215 |
+ eats(fnum, num, 0, -1); |
216 |
+ } |
217 |
+ |
218 |
+-static void ATTRIBUTE_FORMAT((printf, 1, 0)) |
219 |
++ATTRIBUTE_FORMAT((printf, 1, 0)) static void |
220 |
+ verror(const char *const string, va_list args) |
221 |
+ { |
222 |
+ /* |
223 |
+@@ -626,7 +626,7 @@ verror(const char *const string, va_list args) |
224 |
+ fprintf(stderr, "\n"); |
225 |
+ } |
226 |
+ |
227 |
+-static void ATTRIBUTE_FORMAT((printf, 1, 2)) |
228 |
++ATTRIBUTE_FORMAT((printf, 1, 2)) static void |
229 |
+ error(const char *const string, ...) |
230 |
+ { |
231 |
+ va_list args; |
232 |
+@@ -636,7 +636,7 @@ error(const char *const string, ...) |
233 |
+ errors = true; |
234 |
+ } |
235 |
+ |
236 |
+-static void ATTRIBUTE_FORMAT((printf, 1, 2)) |
237 |
++ATTRIBUTE_FORMAT((printf, 1, 2)) static void |
238 |
+ warning(const char *const string, ...) |
239 |
+ { |
240 |
+ va_list args; |
241 |
+@@ -666,7 +666,7 @@ close_file(FILE *stream, char const *dir, char const *name, |
242 |
+ } |
243 |
+ } |
244 |
+ |
245 |
+-static ATTRIBUTE_NORETURN void |
246 |
++ATTRIBUTE_NORETURN static void |
247 |
+ usage(FILE *stream, int status) |
248 |
+ { |
249 |
+ fprintf(stream, |
250 |
+@@ -3597,7 +3597,7 @@ lowerit(char a) |
251 |
+ } |
252 |
+ |
253 |
+ /* case-insensitive equality */ |
254 |
+-static ATTRIBUTE_REPRODUCIBLE bool |
255 |
++ATTRIBUTE_REPRODUCIBLE static bool |
256 |
+ ciequal(register const char *ap, register const char *bp) |
257 |
+ { |
258 |
+ while (lowerit(*ap) == lowerit(*bp++)) |
259 |
+@@ -3606,7 +3606,7 @@ ciequal(register const char *ap, register const char *bp) |
260 |
+ return false; |
261 |
+ } |
262 |
+ |
263 |
+-static ATTRIBUTE_REPRODUCIBLE bool |
264 |
++ATTRIBUTE_REPRODUCIBLE static bool |
265 |
+ itsabbr(register const char *abbr, register const char *word) |
266 |
+ { |
267 |
+ if (lowerit(*abbr) != lowerit(*word)) |
268 |
+@@ -3622,7 +3622,7 @@ itsabbr(register const char *abbr, register const char *word) |
269 |
+ |
270 |
+ /* Return true if ABBR is an initial prefix of WORD, ignoring ASCII case. */ |
271 |
+ |
272 |
+-static ATTRIBUTE_REPRODUCIBLE bool |
273 |
++ATTRIBUTE_REPRODUCIBLE static bool |
274 |
+ ciprefix(char const *abbr, char const *word) |
275 |
+ { |
276 |
+ do |
277 |
+@@ -3725,14 +3725,14 @@ getfields(char *cp, char **array, int arrayelts) |
278 |
+ return nsubs; |
279 |
+ } |
280 |
+ |
281 |
+-static ATTRIBUTE_NORETURN void |
282 |
++ATTRIBUTE_NORETURN static void |
283 |
+ time_overflow(void) |
284 |
+ { |
285 |
+ error(_("time overflow")); |
286 |
+ exit(EXIT_FAILURE); |
287 |
+ } |
288 |
+ |
289 |
+-static ATTRIBUTE_REPRODUCIBLE zic_t |
290 |
++ATTRIBUTE_REPRODUCIBLE static zic_t |
291 |
+ oadd(zic_t t1, zic_t t2) |
292 |
+ { |
293 |
+ #ifdef ckd_add |
294 |
+@@ -3746,7 +3746,7 @@ oadd(zic_t t1, zic_t t2) |
295 |
+ time_overflow(); |
296 |
+ } |
297 |
+ |
298 |
+-static ATTRIBUTE_REPRODUCIBLE zic_t |
299 |
++ATTRIBUTE_REPRODUCIBLE static zic_t |
300 |
+ tadd(zic_t t1, zic_t t2) |
301 |
+ { |
302 |
+ #ifdef ckd_add |
303 |
|
304 |
diff --git a/sys-libs/timezone-data/timezone-data-2022g.ebuild b/sys-libs/timezone-data/timezone-data-2022g.ebuild |
305 |
index 190c46867d53..4ef50b87e84f 100644 |
306 |
--- a/sys-libs/timezone-data/timezone-data-2022g.ebuild |
307 |
+++ b/sys-libs/timezone-data/timezone-data-2022g.ebuild |
308 |
@@ -23,6 +23,10 @@ RDEPEND=" |
309 |
!sys-libs/glibc[vanilla(+)] |
310 |
" |
311 |
|
312 |
+PATCHES=( |
313 |
+ "${FILESDIR}"/${P}-c23.patch |
314 |
+) |
315 |
+ |
316 |
src_unpack() { |
317 |
mkdir "${S}" && cd "${S}" || die |
318 |
default |