Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/autoconf/, sys-devel/autoconf/files/
Date: Thu, 03 Nov 2022 01:24:18
Message-Id: 1667438615.c305a45884a8f01838d6e032f469d7f9423154e1.sam@gentoo
1 commit: c305a45884a8f01838d6e032f469d7f9423154e1
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 3 01:21:36 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 3 01:23:35 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c305a458
7
8 sys-devel/autoconf: further Clang 16 patches for autoconf 2.13
9
10 Reported by matsl when building XEmacs 21.4 (21.5 - which is WIP - works
11 with newer autoconf).
12
13 A bunch of the built-in/provided tests from autoconf 2.13 suffered
14 from -Wimplicit-int or -Wimplicit-function-declaration. We also
15 disable the {get,set}pgrp tests (see the patch for details, but
16 the gist is they're unfixable without some substantial effort
17 on POSIX systems nowadays and there's no need anyway -- they're
18 gone in newer autoconf and we never expect them to fail.)
19
20 Bug: https://bugs.gentoo.org/874366
21 Reported-by: Mats Lidell <matsl <AT> gentoo.org>
22 Signed-off-by: Sam James <sam <AT> gentoo.org>
23
24 ...conf-2.13-r3.ebuild => autoconf-2.13-r4.ebuild} | 1 +
25 ...onf-2.13-Clang-16-fixes-for-various-tests.patch | 243 +++++++++++++++++++++
26 2 files changed, 244 insertions(+)
27
28 diff --git a/sys-devel/autoconf/autoconf-2.13-r3.ebuild b/sys-devel/autoconf/autoconf-2.13-r4.ebuild
29 similarity index 96%
30 rename from sys-devel/autoconf/autoconf-2.13-r3.ebuild
31 rename to sys-devel/autoconf/autoconf-2.13-r4.ebuild
32 index 45a43a49c6f8..3593b3e30269 100644
33 --- a/sys-devel/autoconf/autoconf-2.13-r3.ebuild
34 +++ b/sys-devel/autoconf/autoconf-2.13-r4.ebuild
35 @@ -32,6 +32,7 @@ PATCHES=(
36 "${FILESDIR}"/${P}-test-fixes.patch #146592
37 "${FILESDIR}"/${P}-perl-5.26.patch
38 "${FILESDIR}"/${P}-K-R-decls-clang.patch
39 + "${FILESDIR}"/${P}-Clang-16-fixes-for-various-tests.patch
40 )
41
42 src_configure() {
43
44 diff --git a/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch b/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch
45 new file mode 100644
46 index 000000000000..b9319f0a4b71
47 --- /dev/null
48 +++ b/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch
49 @@ -0,0 +1,243 @@
50 +From de47e22d9b4f5fd5f1c9b9de798218a46ef94b98 Mon Sep 17 00:00:00 2001
51 +From: Sam James <sam@g.o>
52 +Date: Thu, 3 Nov 2022 01:19:39 +0000
53 +Subject: [PATCH] Clang 16 fixes for various tests
54 +
55 +Fixes -Wimplicit-int and -Wimplicit-function-declaration
56 +issues in various built-in tests.
57 +
58 +Noticed when building XEmacs 21.4 (thanks to matsl for reporting).
59 +
60 +Signed-off-by: Sam James <sam@g.o>
61 +--- a/acgeneral.m4
62 ++++ b/acgeneral.m4
63 +@@ -1988,6 +1988,7 @@ changequote([, ])dnl
64 + AC_MSG_CHECKING(size of $1)
65 + AC_CACHE_VAL(AC_CV_NAME,
66 + [AC_TRY_RUN([#include <stdio.h>
67 ++#include <stdlib.h>
68 + main(void)
69 + {
70 + FILE *f=fopen("conftestval", "w");
71 +--- a/acspecific.m4
72 ++++ b/acspecific.m4
73 +@@ -706,6 +706,7 @@ fi
74 + if test $ac_cv_header_stdc = yes; then
75 + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
76 + AC_TRY_RUN([#include <ctype.h>
77 ++#include <stdlib.h>
78 + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
79 + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
80 + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
81 +@@ -819,6 +820,7 @@ esac
82 +
83 + AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
84 + [AC_TRY_RUN([#include <sys/types.h>
85 ++#include <stdlib.h>
86 + #include <$ac_header_dirent>
87 + int closedir(...); int main(void) { exit(closedir(opendir(".")) != 0); }],
88 + ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
89 +@@ -988,6 +990,7 @@ AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
90 + [AC_REQUIRE([AC_HEADER_DIRENT])dnl
91 + AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
92 + [AC_TRY_RUN([#include <sys/types.h>
93 ++#include <stdlib.h>
94 + #include <$ac_header_dirent>
95 + int closedir(...); int main(void) { exit(closedir(opendir(".")) != 0); }],
96 + ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
97 +@@ -1038,6 +1041,7 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
98 + #include <sys/types.h>
99 + #include <fcntl.h>
100 + #include <sys/mman.h>
101 ++#include <stdlib.h>
102 +
103 + /* This mess was copied from the GNU getpagesize.h. */
104 + #ifndef HAVE_GETPAGESIZE
105 +@@ -1165,49 +1169,17 @@ AC_DEFUN(AC_FUNC_GETPGRP,
106 + *
107 + * Snarfed from Chet Ramey's bash pgrp.c test program
108 + */
109 +-#include <stdio.h>
110 +-#include <sys/types.h>
111 +-
112 +-int pid;
113 +-int pg1, pg2, pg3, pg4;
114 +-int ng, np, s, child;
115 ++#include <stdlib.h>
116 +
117 + int main(void)
118 + {
119 +- pid = getpid();
120 +- pg1 = getpgrp(0);
121 +- pg2 = getpgrp();
122 +- pg3 = getpgrp(pid);
123 +- pg4 = getpgrp(1);
124 +-
125 +- /*
126 +- * If all of these values are the same, it's pretty sure that
127 +- * we're on a system that ignores getpgrp's first argument.
128 +- */
129 +- if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
130 +- exit(0);
131 +-
132 +- child = fork();
133 +- if (child < 0)
134 +- exit(1);
135 +- else if (child == 0) {
136 +- np = getpid();
137 +- /*
138 +- * If this is Sys V, this will not work; pgrp will be
139 +- * set to np because setpgrp just changes a pgrp to be
140 +- * the same as the pid.
141 +- */
142 +- setpgrp(np, pg1);
143 +- ng = getpgrp(0); /* Same result for Sys V and BSD */
144 +- if (ng == pg1) {
145 +- exit(1);
146 +- } else {
147 +- exit(0);
148 +- }
149 +- } else {
150 +- wait(&s);
151 +- exit(s>>8);
152 +- }
153 ++ /* XXX: Gentoo: This function used to check for
154 ++ BSD vs POSIX getpgrp but the test fails to compile
155 ++ on modern POSIX systems when not relying on implicit
156 ++ function declarations. It has no value anyway on such
157 ++ systems and it's been removed in newer autoconf.
158 ++ */
159 ++ exit(0);
160 + }
161 + ], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no,
162 + AC_MSG_ERROR(cannot check getpgrp if cross compiling))
163 +@@ -1220,9 +1192,7 @@ fi
164 + AC_DEFUN(AC_FUNC_SETPGRP,
165 + [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
166 + AC_TRY_RUN([
167 +-#ifdef HAVE_UNISTD_H
168 +-#include <unistd.h>
169 +-#endif
170 ++#include <stdlib.h>
171 +
172 + /*
173 + * If this system has a BSD-style setpgrp, which takes arguments, exit
174 +@@ -1230,10 +1200,13 @@ AC_TRY_RUN([
175 + */
176 + int main(void)
177 + {
178 +- if (setpgrp(1,1) == -1)
179 +- exit(0);
180 +- else
181 +- exit(1);
182 ++ /* XXX: Gentoo: This function used to check for
183 ++ BSD vs POSIX gsetpgrp but the test fails to compile
184 ++ on modern POSIX systems when not relying on implicit
185 ++ function declarations. It has no value anyway on such
186 ++ systems and it's been removed in newer autoconf.
187 ++ */
188 ++ exit(1);
189 + }
190 + ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
191 + AC_MSG_ERROR(cannot check setpgrp if cross compiling))
192 +@@ -1255,9 +1228,11 @@ AC_DEFUN(AC_FUNC_VFORK,
193 + AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))
194 + AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
195 + [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */
196 ++#include <stdlib.h>
197 + #include <stdio.h>
198 + #include <sys/types.h>
199 + #include <sys/stat.h>
200 ++#include <sys/wait.h>
201 + #ifdef HAVE_UNISTD_H
202 + #include <unistd.h>
203 + #endif
204 +@@ -1270,7 +1245,7 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
205 + but some compilers (e.g. gcc -O) don't grok <vfork.h>.
206 + Test for this by using a static variable whose address
207 + is put into a register that is clobbered by the vfork. */
208 +-static
209 ++static void
210 + #ifdef __cplusplus
211 + sparc_address_test (int arg)
212 + #else
213 +@@ -1359,6 +1334,7 @@ AC_DEFUN(AC_FUNC_WAIT3,
214 + #include <sys/time.h>
215 + #include <sys/resource.h>
216 + #include <stdio.h>
217 ++#include <stdlib.h>
218 + /* HP-UX has wait3 but does not fill in rusage at all. */
219 + int main(void) {
220 + struct rusage r;
221 +@@ -1582,6 +1558,7 @@ AC_DEFUN(AC_FUNC_UTIME_NULL,
222 + # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
223 + AC_TRY_RUN([#include <sys/types.h>
224 + #include <sys/stat.h>
225 ++#include <stdlib.h>
226 + int main(void) {
227 + struct stat s, t;
228 + exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
229 +@@ -1598,6 +1575,7 @@ fi
230 + AC_DEFUN(AC_FUNC_STRCOLL,
231 + [AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
232 + [AC_TRY_RUN([#include <string.h>
233 ++#include <stdlib.h>
234 + int main (void)
235 + {
236 + exit (strcoll ("abc", "def") >= 0 ||
237 +@@ -1614,6 +1592,7 @@ AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
238 + [AC_CACHE_CHECK(whether setvbuf arguments are reversed,
239 + ac_cv_func_setvbuf_reversed,
240 + [AC_TRY_RUN([#include <stdio.h>
241 ++#include <stdlib.h>
242 + /* If setvbuf has the reversed format, exit 0. */
243 + int main (void) {
244 + /* This call has the arguments reversed.
245 +@@ -1646,7 +1625,8 @@ LIBS="-lintl $LIBS"])])])
246 +
247 + AC_DEFUN(AC_FUNC_MEMCMP,
248 + [AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
249 +-[AC_TRY_RUN([
250 ++[AC_TRY_RUN([#include <stdlib.h>
251 ++#include <string.h>
252 + int main(void)
253 + {
254 + char c0 = 0x40, c1 = 0x80, c2 = 0x81;
255 +@@ -1805,6 +1785,7 @@ AC_TRY_RUN(
256 + #if !defined(__STDC__) || __STDC__ != 1
257 + #define volatile
258 + #endif
259 ++#include <stdlib.h>
260 + int main(void) {
261 + volatile char c = 255; exit(c < 0);
262 + }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
263 +@@ -1819,7 +1800,8 @@ AC_DEFUN(AC_C_LONG_DOUBLE,
264 + [if test "$GCC" = yes; then
265 + ac_cv_c_long_double=yes
266 + else
267 +-AC_TRY_RUN([int main(void) {
268 ++AC_TRY_RUN([#include <stdlib.h>
269 ++int main(void) {
270 + /* The Stardent Vistra knows sizeof(long double), but does not support it. */
271 + long double foo = 0.0;
272 + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
273 +@@ -1834,7 +1816,8 @@ fi
274 + AC_DEFUN(AC_INT_16_BITS,
275 + [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl
276 + AC_MSG_CHECKING(whether int is 16 bits)
277 +-AC_TRY_RUN([int main(void) { exit(sizeof(int) != 2); }],
278 ++AC_TRY_RUN([#include <stdlib.h>
279 ++int main(void) { exit(sizeof(int) != 2); }],
280 + [AC_MSG_RESULT(yes)
281 + AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))
282 + ])
283 +@@ -1842,7 +1825,8 @@ AC_TRY_RUN([int main(void) { exit(sizeof(int) != 2); }],
284 + AC_DEFUN(AC_LONG_64_BITS,
285 + [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl
286 + AC_MSG_CHECKING(whether long int is 64 bits)
287 +-AC_TRY_RUN([int main(void) { exit(sizeof(long int) != 8); }],
288 ++AC_TRY_RUN([#include <stdlib.h>
289 ++int main(void) { exit(sizeof(long int) != 8); }],
290 + [AC_MSG_RESULT(yes)
291 + AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))
292 + ])