From 8562844ef9a0935ea6f4fbb23e30c777e89115f0 Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Thu, 4 Jun 2020 00:32:22 +0100 Subject: [PATCH] GCC-10: default to -fno-common by default GCC-10+ has switched -fno-common on by default. Previously, this was causing compilation failures where the .DATA blocks are now used, which means extern variables need declaring outside of .h files. This change makes those adjustments. Fixes #119 --- configure.ac | 2 +- fvwm/virtual.c | 2 ++ fvwm/virtual.h | 2 +- libs/FScreen.c | 6 ++++++ libs/FScreen.h | 10 +++++----- modules/FvwmPager/FvwmPager.c | 2 ++ modules/FvwmPager/FvwmPager.h | 2 +- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 3e52bb805..4ddd1116c 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,7 @@ AC_PROG_CPP # added -Wall for gcc, what about for others? if test "x$GCC" = "xyes"; then - CFLAGS="-Wall -Wno-implicit-int -fcommon $CFLAGS" + CFLAGS="-Wall -Wno-implicit-int -fno-common $CFLAGS" fi # Help finding POSIX functions on some systems diff --git a/fvwm/virtual.c b/fvwm/virtual.c index 384a49e55..8311e44aa 100644 --- a/fvwm/virtual.c +++ b/fvwm/virtual.c @@ -84,6 +84,8 @@ static int last_edge_thickness = 2; static void store_desktop_cmd(int, char *); static int number_of_desktops(struct monitor *); +struct desktop_cmds desktop_cmd_q; + /* ---------------------------- exported variables (globals) --------------- */ /* ---------------------------- local functions ---------------------------- */ diff --git a/fvwm/virtual.h b/fvwm/virtual.h index d3bf50873..819637b5c 100644 --- a/fvwm/virtual.h +++ b/fvwm/virtual.h @@ -28,7 +28,7 @@ struct desktop_cmd { TAILQ_ENTRY(desktop_cmd) entry; }; TAILQ_HEAD(desktop_cmds, desktop_cmd); -struct desktop_cmds desktop_cmd_q; +extern struct desktop_cmds desktop_cmd_q; void apply_desktops_monitor(struct monitor *); diff --git a/libs/FScreen.c b/libs/FScreen.c index 9139aadd7..c8cc5d2b6 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -54,6 +54,12 @@ static void monitor_set_flags(struct monitor *); static void scan_screens(Display *); static void monitor_check_primary(void); +enum monitor_tracking monitor_mode; +DesktopsInfo *ReferenceDesktops; +struct screen_infos screen_info_q; +struct monitors monitor_q; +int randr_event; + static void GetMouseXY(XEvent *eventp, int *x, int *y) { XEvent e; diff --git a/libs/FScreen.h b/libs/FScreen.h index a2278b17a..e8c4a7753 100644 --- a/libs/FScreen.h +++ b/libs/FScreen.h @@ -70,8 +70,8 @@ enum monitor_tracking MONITOR_TRACKING_M, }; -enum monitor_tracking monitor_mode; -DesktopsInfo *ReferenceDesktops; +extern enum monitor_tracking monitor_mode; +extern DesktopsInfo *ReferenceDesktops; struct screen_info { const char *name; @@ -85,7 +85,7 @@ struct screen_info { }; TAILQ_HEAD(screen_infos, screen_info); -struct screen_infos screen_info_q; +extern struct screen_infos screen_info_q; struct screen_info *screen_info_new(void); struct screen_info *screen_info_by_name(const char *); @@ -150,7 +150,7 @@ struct monitor { }; TAILQ_HEAD(monitors, monitor); -struct monitors monitor_q; +extern struct monitors monitor_q; struct monitor *monitor_by_name(const char *); struct monitor *monitor_by_xy(int, int); @@ -166,7 +166,7 @@ void monitor_add_new(void); #define FSCREEN_MANGLE_USPOS_HINTS_MAGIC ((short)-32109) -int randr_event; +extern int randr_event; /* Control */ Bool FScreenIsEnabled(void); diff --git a/modules/FvwmPager/FvwmPager.c b/modules/FvwmPager/FvwmPager.c index 6de5a7683..4786893ce 100644 --- a/modules/FvwmPager/FvwmPager.c +++ b/modules/FvwmPager/FvwmPager.c @@ -62,6 +62,8 @@ PagerStringList *NewPagerStringItem(PagerStringList *last, int desk); extern FlocaleFont *FwindowFont; extern Pixmap default_pixmap; +struct fpmonitors fp_monitor_q; + /* * * Screen, font, etc info diff --git a/modules/FvwmPager/FvwmPager.h b/modules/FvwmPager/FvwmPager.h index 46d9afb74..c5edbf365 100644 --- a/modules/FvwmPager/FvwmPager.h +++ b/modules/FvwmPager/FvwmPager.h @@ -31,7 +31,7 @@ struct fpmonitor { }; TAILQ_HEAD(fpmonitors, fpmonitor); -struct fpmonitors fp_monitor_q; +extern struct fpmonitors fp_monitor_q; struct fpmonitor *fpmonitor_by_name(const char *); struct fpmonitor *fpmonitor_by_output(int); struct fpmonitor *fpmonitor_get_current(void);