summaryrefslogtreecommitdiff
blob: 33e0d444bd56e9248ba2ab3e04961f4ee89ba167 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From f27827d7937375b5348107ca7427abf74c9eff3d Mon Sep 17 00:00:00 2001
From: michi <michi+ngircd@dataswamp.org>
Date: Tue, 14 Apr 2020 16:53:02 +0200
Subject: [PATCH] Unbreak GCC 10 (-fno-common) build

---
 src/ngircd/conn.c   |  1 +
 src/ngircd/conn.h   | 14 +++++++++++---
 src/ngircd/ngircd.c |  1 +
 src/portab/portab.h |  4 ++++
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index f62e9675..e14e6c08 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -10,6 +10,7 @@
  */
 
 #define CONN_MODULE
+#define CONN_MODULE_GLOBAL_INIT
 
 #include "portab.h"
 
diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h
index c642541f..869477f0 100644
--- a/src/ngircd/conn.h
+++ b/src/ngircd/conn.h
@@ -105,9 +105,17 @@ typedef struct _Connection
 #endif
 } CONNECTION;
 
-GLOBAL CONNECTION *My_Connections;
-GLOBAL CONN_ID Pool_Size;
-GLOBAL long WCounter;
+
+#ifdef CONN_MODULE_GLOBAL_INIT
+CONNECTION *My_Connections;
+CONN_ID Pool_Size;
+long WCounter;
+#else
+extern CONNECTION *My_Connections;
+extern CONN_ID Pool_Size;
+extern long WCounter;
+#endif
+
 
 #define CONNECTION2ID(x) (long)(x - My_Connections)
 
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index 7166640b..41255ca0 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -9,6 +9,7 @@
  * Please read the file COPYING, README and AUTHORS for more information.
  */
 
+#define GLOBAL_INIT
 #include "portab.h"
 
 /**
diff --git a/src/portab/portab.h b/src/portab/portab.h
index 70d5ed3e..43f2f907 100644
--- a/src/portab/portab.h
+++ b/src/portab/portab.h
@@ -102,7 +102,11 @@ typedef unsigned char bool;
 #endif
 
 #undef GLOBAL
+#ifdef GLOBAL_INIT
 #define GLOBAL
+#else
+#define GLOBAL extern
+#endif
 
 /* SPLint */