1 From d256d9055095f27a33696e0aeda4ee20ed4fb1a0 Mon Sep 17 00:00:00 2001
2 From: Reiner Herrmann <reiner@reiner-h.de>
3 Date: Fri, 17 Apr 2020 19:25:40 +0200
4 Subject: [PATCH] Move variable declarations from header to C file to fix build
7 GCC 10 builds with -fno-common by default, which causes linker errors when
8 variables are declared in header files and included in multiple places.
10 See also: https://gcc.gnu.org/gcc-10/porting_to.html
12 common/lualib.c | 2 ++
13 common/lualib.h | 2 +-
16 objects/button.c | 2 ++
17 objects/button.h | 2 +-
18 objects/client.c | 2 ++
19 objects/client.h | 2 +-
20 objects/drawin.c | 2 ++
21 objects/drawin.h | 2 +-
26 objects/window.c | 1 +
27 objects/window.h | 2 +-
28 16 files changed, 23 insertions(+), 8 deletions(-)
30 diff --git a/common/lualib.c b/common/lualib.c
31 index 312fb2d594..bb110ac716 100644
35 #include "common/lualib.h"
38 +lua_CFunction lualib_dofunction_on_error;
40 void luaA_checkfunction(lua_State *L, int idx)
42 if(!lua_isfunction(L, idx))
43 diff --git a/common/lualib.h b/common/lualib.h
44 index 8a3ef089d7..a91261843c 100644
48 #include "common/util.h"
50 /** Lua function to call on dofunction() error */
51 -lua_CFunction lualib_dofunction_on_error;
52 +extern lua_CFunction lualib_dofunction_on_error;
54 void luaA_checkfunction(lua_State *, int);
55 void luaA_checktable(lua_State *, int);
56 diff --git a/luaa.c b/luaa.c
57 index 419a8c2eb2..aeaba9cd1f 100644
60 @@ -91,6 +91,8 @@ extern const struct luaL_Reg awesome_mouse_meta[];
61 extern const struct luaL_Reg awesome_root_methods[];
62 extern const struct luaL_Reg awesome_root_meta[];
64 +signal_array_t global_signals;
66 /** A call into the Lua code aborted with an error.
68 * This signal is used in the example configuration, @{05-awesomerc.md},
69 diff --git a/luaa.h b/luaa.h
70 index e159258348..d26c437691 100644
73 @@ -317,7 +317,7 @@ const char *luaA_find_config(xdgHandle *, const char *, luaA_config_callback *);
74 bool luaA_parserc(xdgHandle *, const char *);
77 -signal_array_t global_signals;
78 +extern signal_array_t global_signals;
80 int luaA_class_index_miss_property(lua_State *, lua_object_t *);
81 int luaA_class_newindex_miss_property(lua_State *, lua_object_t *);
82 diff --git a/objects/button.c b/objects/button.c
83 index 892347a928..5ffdcd4432 100644
84 --- a/objects/button.c
85 +++ b/objects/button.c
90 +lua_class_t button_class;
94 * @tfield int button The mouse button number, or 0 for any button.
95 diff --git a/objects/button.h b/objects/button.h
96 index fb8bb8da28..8f0b894305 100644
97 --- a/objects/button.h
98 +++ b/objects/button.h
99 @@ -39,7 +39,7 @@ typedef struct button_t
103 -lua_class_t button_class;
104 +extern lua_class_t button_class;
105 LUA_OBJECT_FUNCS(button_class, button_t, button)
106 ARRAY_FUNCS(button_t *, button, DO_NOTHING)
108 diff --git a/objects/client.c b/objects/client.c
109 index 7b2d3a2022..b617a9e7a9 100644
110 --- a/objects/client.c
111 +++ b/objects/client.c
113 #include <xcb/shape.h>
114 #include <cairo-xcb.h>
116 +lua_class_t client_class;
120 * This table allow to add more dynamic properties to the clients. For example,
121 diff --git a/objects/client.h b/objects/client.h
122 index 74a23131c5..387e7c2aea 100644
123 --- a/objects/client.h
124 +++ b/objects/client.h
125 @@ -200,7 +200,7 @@ struct client_t
126 ARRAY_FUNCS(client_t *, client, DO_NOTHING)
129 -lua_class_t client_class;
130 +extern lua_class_t client_class;
132 LUA_OBJECT_FUNCS(client_class, client_t, client)
134 diff --git a/objects/drawin.c b/objects/drawin.c
135 index 3fd1cc4350..3bbd93179c 100644
136 --- a/objects/drawin.c
137 +++ b/objects/drawin.c
139 #include <cairo-xcb.h>
140 #include <xcb/shape.h>
142 +lua_class_t drawin_class;
146 * @field border_width Border width.
147 diff --git a/objects/drawin.h b/objects/drawin.h
148 index 31f315aac5..2f8887d944 100644
149 --- a/objects/drawin.h
150 +++ b/objects/drawin.h
151 @@ -52,7 +52,7 @@ void luaA_drawin_systray_kickout(lua_State *);
153 void drawin_class_setup(lua_State *);
155 -lua_class_t drawin_class;
156 +extern lua_class_t drawin_class;
159 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
160 diff --git a/objects/key.c b/objects/key.c
161 index c42f7446d8..365ba998cc 100644
165 #include <xkbcommon/xkbcommon.h>
168 +lua_class_t key_class;
172 * @tfield string key The key to trigger an event.
173 diff --git a/objects/key.h b/objects/key.h
174 index 8aa07ffe3d..45f23cac79 100644
177 @@ -36,7 +36,7 @@ typedef struct keyb_t
178 xcb_keycode_t keycode;
181 -lua_class_t key_class;
182 +extern lua_class_t key_class;
183 LUA_OBJECT_FUNCS(key_class, keyb_t, key)
184 DO_ARRAY(keyb_t *, key, DO_NOTHING)
186 diff --git a/objects/tag.c b/objects/tag.c
187 index a0050cc2a9..1b1a135762 100644
194 +lua_class_t tag_class;
197 * @signal request::select
199 diff --git a/objects/tag.h b/objects/tag.h
200 index d6bb40e0d8..f830b1e2c5 100644
203 @@ -46,7 +46,7 @@ struct tag
204 client_array_t clients;
207 -lua_class_t tag_class;
208 +extern lua_class_t tag_class;
209 LUA_OBJECT_FUNCS(tag_class, tag_t, tag)
211 void tag_class_setup(lua_State *);
212 diff --git a/objects/window.c b/objects/window.c
213 index 440970f3d0..371d06bcd3 100644
214 --- a/objects/window.c
215 +++ b/objects/window.c
217 #include "property.h"
220 +lua_class_t window_class;
221 LUA_CLASS_FUNCS(window, window_class)
224 diff --git a/objects/window.h b/objects/window.h
225 index 5386fafead..fbc5296cf5 100644
226 --- a/objects/window.h
227 +++ b/objects/window.h
228 @@ -80,7 +80,7 @@ typedef struct
232 -lua_class_t window_class;
233 +extern lua_class_t window_class;
235 void window_class_setup(lua_State *);