summaryrefslogtreecommitdiff
path: root/dev-lang/mono/files/mono-6.12.0.199-configure-c99.patch
blob: 3018dbe8339c7cd7119c169dfd62fd4a9fd00d80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
https://github.com/mono/mono/pull/21730

From 90315aa24569d13da93230ac2d3e5ec3c96f35b4 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Sat, 9 Dec 2023 00:06:09 +0100
Subject: [PATCH] configure: Fix type errors in __thread test

The thread start routine must return void *, and int and void *
are distinct types.  Compilers increasingly issue errors instead
of warnings for such type errors, and this causes the configure
probe to fail unconditionally, even if the system supports
__thread variables.
---
 configure.ac | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index dbc4904d9b2e4..7518439118e37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2831,14 +2831,16 @@ if test x$host_win32 = xno; then
 			__thread int i;
 			static int res1, res2;
 
-			void thread_main (void *arg)
+			void *thread_main (void *parg)
 			{
+				int arg = *(int *)parg;
 				i = arg;
 				sleep (1);
 				if (arg == 1)
 					res1 = (i == arg);
 				else
 					res2 = (i == arg);
+				return NULL;
 			}
 
 			int main () {
@@ -2846,8 +2848,10 @@ if test x$host_win32 = xno; then
 
 				i = 5;
 
-				pthread_create (&t1, NULL, thread_main, 1);
-				pthread_create (&t2, NULL, thread_main, 2);
+				int one = 1;
+				pthread_create (&t1, NULL, thread_main, &one);
+				int two = 2;
+				pthread_create (&t2, NULL, thread_main, &two);
 
 				pthread_join (t1, NULL);
 				pthread_join (t2, NULL);