0002-Fix-configure-failures-with-Xcode12.patch 3.0 KB

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