File 1167-Make-poll-test-work-with-gcc-14.patch of Package erlang

From 189d3122c7b3b1fe6899f5b906885cf2ccc3b9c2 Mon Sep 17 00:00:00 2001
From: Luke Bakken <luke@bakken.io>
Date: Tue, 17 Dec 2024 10:28:19 -0800
Subject: [PATCH] Make `poll()` test work with `gcc` 14

Fixes erlang/otp#9211

* Add headers (`stdlib.h`, `fcntl.h`) for `poll`
* Add `unistd.h` for `sbrk`
---
 erts/configure    | 5 ++++-
 erts/configure.ac | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/erts/configure b/erts/configure
index 2044690dc6..05fca7b4b2 100755
--- a/erts/configure
+++ b/erts/configure
@@ -20934,6 +20934,7 @@ else $as_nop
 /* end confdefs.h.  */
 
 #include <stdlib.h>
+#include <unistd.h>
 #ifdef HAVE_MALLOC_H
 #  include <malloc.h>
 #endif
@@ -24889,8 +24890,10 @@ else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#include <fcntl.h>
 #include <poll.h>
-main()
+#include <stdlib.h>
+int main()
 {
 #ifdef _POLL_EMUL_H_
   exit(1); /* Implemented using select() -- fail */
diff --git a/erts/configure.in b/erts/configure.in
index f247c1e71f..7b14880d49 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -2456,6 +2456,7 @@ AC_CACHE_CHECK([if __after_morecore_hook can track malloc()s core memory use],
 		erts_cv___after_morecore_hook_can_track_malloc,
 		[AC_TRY_RUN([
 #include <stdlib.h>
+#include <unistd.h>
 #ifdef HAVE_MALLOC_H
 #  include <malloc.h>
 #endif
@@ -3098,8 +3099,10 @@ poll_works=no
 else
 
 AC_TRY_RUN([
+#include <fcntl.h>
 #include <poll.h>
-main()
+#include <stdlib.h>
+int main()
 {
 #ifdef _POLL_EMUL_H_
   exit(1); /* Implemented using select() -- fail */
-- 
2.43.0

openSUSE Build Service is sponsored by