File 0979-erts-Eliminate-warnings-in-C-code-in-tests.patch of Package erlang

From bc1872ab36d4e3d1459c504eabc03b5d14b22639 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 24 Sep 2020 06:50:07 +0200
Subject: [PATCH 1/4] erts: Eliminate warnings in C code in tests

Apple Clang 12 in Xcode 12 reports an error for the use of a
function without a declaration.
---
 .../test/driver_SUITE_data/peek_non_existing_queue_drv.c  | 4 ++++
 erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c  | 4 ++++
 erts/emulator/test/estone_SUITE_data/estone_cat.c         | 8 +++++---
 erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c             | 1 +
 erts/emulator/test/port_bif_SUITE_data/port_test.c        | 3 ++-
 erts/emulator/test/trace_SUITE_data/slow_drv.c            | 6 ++++++
 6 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
index 685cda3e07..b69d75c31d 100644
--- a/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/peek_non_existing_queue_drv.c
@@ -47,6 +47,10 @@
 #include <windows.h>
 #endif
 
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
 #include <errno.h>
 
 #include "erl_driver.h"
diff --git a/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c b/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c
index 56183c9484..503d8b902c 100644
--- a/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/thr_msg_blast_drv.c
@@ -18,6 +18,10 @@
  * %CopyrightEnd%
  */
 
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
 #include "erl_driver.h"
 
 #define THR_MSG_BLAST_NO_PROCS 10
diff --git a/erts/emulator/test/estone_SUITE_data/estone_cat.c b/erts/emulator/test/estone_SUITE_data/estone_cat.c
index a34bda4384..cbdf3db6c9 100644
--- a/erts/emulator/test/estone_SUITE_data/estone_cat.c
+++ b/erts/emulator/test/estone_SUITE_data/estone_cat.c
@@ -12,9 +12,11 @@
 #include <fcntl.h>
 #include <errno.h>
 
-main(argc, argv)
-int argc;
-char *argv[];
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
+int main(int argc, char* argv[])
 {
     char buf[16384];
     int n;
diff --git a/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c b/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c
index 46ee8b5540..6f662ae514 100644
--- a/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c
+++ b/erts/emulator/test/mtx_SUITE_data/mtx_SUITE.c
@@ -39,6 +39,7 @@
 
 #include <errno.h>
 #include <stdio.h>
+#include <string.h>
 
 static int
 fail(const char *file, int line, const char *function, const char *assertion);
diff --git a/erts/emulator/test/port_bif_SUITE_data/port_test.c b/erts/emulator/test/port_bif_SUITE_data/port_test.c
index 923ab99ccc..ef6d12dc93 100644
--- a/erts/emulator/test/port_bif_SUITE_data/port_test.c
+++ b/erts/emulator/test/port_bif_SUITE_data/port_test.c
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <ctype.h>
 
 #ifndef __WIN32__
 #include <unistd.h>
@@ -32,7 +33,7 @@
     exit(1); \
 }
 
-#define MAIN(argc, argv) main(argc, argv)
+#define MAIN(argc, argv) int main(argc, argv)
 
 extern int errno;
 
-- 
2.26.2

openSUSE Build Service is sponsored by