logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

erlang-25.1.2-c99.patch (2686B)


  1. Bug: https://bugs.gentoo.org/882887
  2. From: https://github.com/erlang/otp/pull/6504
  3. From: Florian Weimer <fweimer@redhat.com>
  4. Date: Thu, 24 Nov 2022 11:57:49 +0100
  5. Subject: [PATCH 1/2] configure.ac: C99 fix for
  6. ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC
  7. #include <unistd.h> for the sbrk function if the header is available.
  8. --- a/erts/configure
  9. +++ b/erts/configure
  10. @@ -20752,6 +20752,9 @@ else $as_nop
  11. #ifdef HAVE_MALLOC_H
  12. # include <malloc.h>
  13. #endif
  14. +#ifdef HAVE_UNISTD_H
  15. +# include <unistd.h>
  16. +#endif
  17. #if defined(HAVE_END_SYMBOL)
  18. extern char end;
  19. #elif defined(HAVE__END_SYMBOL)
  20. --- a/erts/configure.ac
  21. +++ b/erts/configure.ac
  22. @@ -2436,6 +2436,9 @@ AC_CACHE_CHECK([if __after_morecore_hook can track malloc()s core memory use],
  23. #ifdef HAVE_MALLOC_H
  24. # include <malloc.h>
  25. #endif
  26. +#ifdef HAVE_UNISTD_H
  27. +# include <unistd.h>
  28. +#endif
  29. #if defined(HAVE_END_SYMBOL)
  30. extern char end;
  31. #elif defined(HAVE__END_SYMBOL)
  32. From 7b720d2bb9e742110ff90ec2495747b2c477e2c7 Mon Sep 17 00:00:00 2001
  33. From: Florian Weimer <fweimer@redhat.com>
  34. Date: Thu, 24 Nov 2022 11:59:22 +0100
  35. Subject: [PATCH 2/2] configure.ac: C99 fixes for poll_works check
  36. Include <fcntl.h> if it is available for the open prototype.
  37. Return from main instead of calling exit, so that no function
  38. declaration is needed.
  39. --- a/erts/configure
  40. +++ b/erts/configure
  41. @@ -24663,10 +24663,13 @@ else $as_nop
  42. /* end confdefs.h. */
  43. #include <poll.h>
  44. -main()
  45. +#ifdef HAVE_FCNTL_H
  46. +#include <fcntl.h>
  47. +#endif
  48. +int main()
  49. {
  50. #ifdef _POLL_EMUL_H_
  51. - exit(1); /* Implemented using select() -- fail */
  52. + return 1; /* Implemented using select() -- fail */
  53. #else
  54. struct pollfd fds[1];
  55. int fd;
  56. @@ -24675,9 +24678,9 @@ main()
  57. fds[0].events = POLLIN;
  58. fds[0].revents = 0;
  59. if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
  60. - exit(1); /* Does not work for devices -- fail */
  61. + return 1; /* Does not work for devices -- fail */
  62. }
  63. - exit(0);
  64. + return 0;
  65. #endif
  66. }
  67. --- a/erts/configure.ac
  68. +++ b/erts/configure.ac
  69. @@ -3036,10 +3036,13 @@ poll_works=no
  70. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  71. #include <poll.h>
  72. -main()
  73. +#ifdef HAVE_FCNTL_H
  74. +#include <fcntl.h>
  75. +#endif
  76. +int main()
  77. {
  78. #ifdef _POLL_EMUL_H_
  79. - exit(1); /* Implemented using select() -- fail */
  80. + return 1; /* Implemented using select() -- fail */
  81. #else
  82. struct pollfd fds[1];
  83. int fd;
  84. @@ -3048,9 +3051,9 @@ main()
  85. fds[0].events = POLLIN;
  86. fds[0].revents = 0;
  87. if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
  88. - exit(1); /* Does not work for devices -- fail */
  89. + return 1; /* Does not work for devices -- fail */
  90. }
  91. - exit(0);
  92. + return 0;
  93. #endif
  94. }
  95. ]])],[poll_works=yes],[poll_works=no],[