blob: 453515f9267f407e17f98410ca4b532fefb85a78 [file] [log] [blame]
Fabrice Fontaine3bb42662024-07-20 14:29:08 +02001From bbc43ca6ae0bec4f64e69c9cd4c967005d6470eb Mon Sep 17 00:00:00 2001
2From: Mitchell Blank Jr <mitch@bodyfour.com>
3Date: Mon, 21 Dec 2020 12:05:19 +0000
4Subject: [PATCH] Fix configure failures with Xcode12
5
6Changes are needed becuase Xcode12 includes a default of
7-Werror,-Wimplicit-function-declaration which means that
8even something like calling "exit(0);" is a compile failure
9if you haven't done a "#include <stdlib.h>" first (as C99
10requires, but most other compilers will just warn about)
11
12I don't know if the "long long reliability test 2" test which
13tries to provoke a crash on a particular gcc 3.3 build still
14does what it was originally intended to do with my change.
15Of course, I doubt anyone has tried to use that compiler in
16years.
17
18Fixes #290
19
20Upstream: https://github.com/wbhart/mpir/commit/bbc43ca6ae0bec4f64e69c9cd4c967005d6470eb
21Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
22---
23 acinclude.m4 | 24 +++++++++++++-----------
24 1 file changed, 13 insertions(+), 11 deletions(-)
25
26diff --git a/acinclude.m4 b/acinclude.m4
27index 91c35bc23..620a629ef 100644
28--- a/acinclude.m4
29+++ b/acinclude.m4
30@@ -589,9 +589,9 @@ extern
31 #endif
32 __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
33 {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
34-f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
35+void f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
36 for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
37-h(){}g(){}
38+void h(){} void g(){}
39 #else
40 int dummy;
41 #endif
42@@ -603,8 +603,9 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 2],
43 1666 to get an ICE with -O1 -mpowerpc64. */
44
45 #ifdef __GNUC__
46-f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
47-g(){}
48+extern int g();
49+void f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
50+int g(){return 0;}
51 #else
52 int dummy;
53 #endif
54@@ -3323,11 +3324,11 @@ check (va_alist)
55 ret = vsnprintf (buf, 4, fmt, ap);
56
57 if (strcmp (buf, "hel") != 0)
58- exit (1);
59+ return 1;
60
61 /* allowed return values */
62 if (ret != -1 && ret != 3 && ret != 11)
63- exit (2);
64+ return 2;
65
66 return 0;
67 }
68@@ -3336,7 +3337,7 @@ int
69 main ()
70 {
71 $i
72- exit (0);
73+ return 0;
74 }
75 ],
76 [:],
77@@ -3469,7 +3470,7 @@ cat >conftest.c <<EOF
78 int
79 main ()
80 {
81- exit(0);
82+ return 0;
83 }
84 EOF
85 gmp_compile="$1 conftest.c"
86@@ -3543,7 +3544,7 @@ AC_CACHE_CHECK([for build system executable suffix],
87 int
88 main ()
89 {
90- exit (0);
91+ return 0;
92 }
93 EOF
94 for i in .exe ,ff8 ""; do
95@@ -3577,7 +3578,7 @@ AC_CACHE_CHECK([whether build system compiler is ANSI],
96 int
97 main (int argc, char *argv[])
98 {
99- exit(0);
100+ return 0;
101 }
102 EOF
103 gmp_compile="$CC_FOR_BUILD conftest.c"
104@@ -3608,10 +3609,11 @@ AC_DEFUN([GMP_CHECK_LIBM_FOR_BUILD],
105 AC_CACHE_CHECK([for build system compiler math library],
106 gmp_cv_check_libm_for_build,
107 [cat >conftest.c <<EOF
108+#include <math.h>
109 int
110 main ()
111 {
112- exit(0);
113+ return 0;
114 }
115 double d;
116 double