From 3acb239918dd964b4f840093a5c55dc48bee0b29 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 15 Oct 2021 22:12:16 +0200 Subject: [PATCH] fix build with GCC 10 and upper GCC switched default from -fcommon to -fno-common, leading to the following compilation errors: multiple definition of `argv0' multiple definition of `display' multiple definition of `scr' multiple definition of `font' multiple definition of `cnorm' multiple definition of `csel' multiple definition of `debugflag' multiple definition of `debugfile' multiple definition of `cursor' multiple definition of `framehandler' multiple definition of `NM' --- cmd/menu/dat.h | 6 +++--- cmd/menu/main.c | 7 +++++++ cmd/strut/dat.h | 2 +- cmd/strut/main.c | 4 ++++ cmd/tray/main.c | 4 ++++ cmd/wmii/dat.h | 6 +++--- cmd/wmii/debug.h | 4 ++-- cmd/wmii/main.c | 7 +++++++ cmd/wmiir.c | 2 ++ cmd/x11/wikeyname.c | 4 ++++ cmd/x11/wmii9menu.c | 4 ++++ include/stuff/x11.h | 4 ++-- lib/libstuff/map.c | 2 +- 13 files changed, 44 insertions(+), 12 deletions(-) diff --git a/cmd/menu/dat.h b/cmd/menu/dat.h index e9804796..e9830518 100644 --- a/cmd/menu/dat.h +++ b/cmd/menu/dat.h @@ -93,9 +93,9 @@ EXTERN struct { int maxwidth; } match; -Font* font; -CTuple cnorm; -CTuple csel; +extern Font* font; +extern CTuple cnorm; +extern CTuple csel; EXTERN Item hist; EXTERN Item* histsel; diff --git a/cmd/menu/main.c b/cmd/menu/main.c index 605eda68..8d8906d8 100644 --- a/cmd/menu/main.c +++ b/cmd/menu/main.c @@ -12,6 +12,13 @@ #include "fns.h" #define link _link +char *argv0; +Display *display; +Screen scr; +Font* font; +CTuple cnorm; +CTuple csel; + static const char version[] = "wimenu-"VERSION", "COPYRIGHT"\n"; static Biobuf* cmplbuf; static Biobuf* inbuf; diff --git a/cmd/strut/dat.h b/cmd/strut/dat.h index 50b539d3..eb3c57e9 100644 --- a/cmd/strut/dat.h +++ b/cmd/strut/dat.h @@ -12,6 +12,6 @@ enum { DAuto, DHorizontal, DVertical }; -EXTERN Handlers handlers; +extern Handlers handlers; EXTERN int direction; diff --git a/cmd/strut/main.c b/cmd/strut/main.c index 652b375f..9b8cd7cd 100644 --- a/cmd/strut/main.c +++ b/cmd/strut/main.c @@ -9,6 +9,10 @@ #include #include "fns.h" +char *argv0; +Display *display; +Screen scr; + static Window* testwin; static ulong testtime[2]; diff --git a/cmd/tray/main.c b/cmd/tray/main.c index 5e4e22f3..c9d4b365 100644 --- a/cmd/tray/main.c +++ b/cmd/tray/main.c @@ -11,6 +11,10 @@ #include #include "fns.h" +char *argv0; +Display *display; +Screen scr; + static const char version[] = "witray-"VERSION", "COPYRIGHT"\n"; static int exitsignal; diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h index 1e9ccb78..38e96288 100644 --- a/cmd/wmii/dat.h +++ b/cmd/wmii/dat.h @@ -42,7 +42,7 @@ enum { CurNone, CurLast, }; -Cursor cursor[CurLast]; +extern Cursor cursor[CurLast]; enum IncMode { IIgnore, @@ -355,11 +355,11 @@ EXTERN Key* key; EXTERN View* selview; EXTERN View* view; -EXTERN Handlers framehandler; +extern Handlers framehandler; /* IXP */ EXTERN IxpServer srv; -EXTERN Ixp9Srv p9srv; +extern Ixp9Srv p9srv; /* X11 */ EXTERN uint numlock_mask; diff --git a/cmd/wmii/debug.h b/cmd/wmii/debug.h index b447c939..9de01746 100644 --- a/cmd/wmii/debug.h +++ b/cmd/wmii/debug.h @@ -20,5 +20,5 @@ void dwrite(int, void*, int, bool); bool setdebug(int); void vdebug(int, const char*, va_list); -long debugflag; -long debugfile; +extern long debugflag; +extern long debugfile; diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c index fc5f43a9..e7e14a92 100644 --- a/cmd/wmii/main.c +++ b/cmd/wmii/main.c @@ -14,6 +14,13 @@ #include #include "fns.h" +char *argv0; +Display *display; +Screen scr; +Cursor cursor[CurLast]; +long debugflag; +long debugfile; + static const char version[] = "wmii-"VERSION", "COPYRIGHT"\n"; diff --git a/cmd/wmiir.c b/cmd/wmiir.c index ecf9a92c..c242d14e 100644 --- a/cmd/wmiir.c +++ b/cmd/wmiir.c @@ -20,6 +20,8 @@ #include #include +char *argv0; + static IxpClient* client; static Biobuf* outbuf; static bool binary; diff --git a/cmd/x11/wikeyname.c b/cmd/x11/wikeyname.c index 6e25ac40..39c91a45 100644 --- a/cmd/x11/wikeyname.c +++ b/cmd/x11/wikeyname.c @@ -7,6 +7,10 @@ #include #include +char *argv0; +Display *display; +Screen scr; + static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n"; static Handlers handlers; diff --git a/cmd/x11/wmii9menu.c b/cmd/x11/wmii9menu.c index f47c8a0a..b37dd05c 100644 --- a/cmd/x11/wmii9menu.c +++ b/cmd/x11/wmii9menu.c @@ -48,6 +48,10 @@ #include #include +char *argv0; +Display *display; +Screen scr; + char version[] = "wmii9menu-"VERSION" "COPYRIGHT", ©1994 David Hogan, Arnold Robbins"; static Window* menuwin; diff --git a/include/stuff/x11.h b/include/stuff/x11.h index 08fb642f..1cff5ef9 100644 --- a/include/stuff/x11.h +++ b/include/stuff/x11.h @@ -214,8 +214,8 @@ struct Screen { # pragma varargck type "W" Window* #endif -Display *display; -Screen scr; +extern Display *display; +extern Screen scr; extern char* modkey_names[]; extern struct Map windowmap; diff --git a/lib/libstuff/map.c b/lib/libstuff/map.c index 65182f70..c3a3aae6 100644 --- a/lib/libstuff/map.c +++ b/lib/libstuff/map.c @@ -13,7 +13,7 @@ struct MapEnt { MapEnt* next; }; -MapEnt *NM; +static MapEnt *NM; /* By Dan Bernstein. Public domain. */ static ulong